class Plugins::Silly
Attributes
pokers[R]
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/Zeta/plugins/silly.rb, line 25 def initialize *args super @pokers = {} end
Public Instance Methods
execute_botinsult(m)
click to toggle source
# File lib/Zeta/plugins/silly.rb, line 52 def execute_botinsult(m) m.reply ["Stupid human!", "Dumb human!", "Stupid meatbag.", "Silly human, your insults cannot harm me!", "get rekt", "u fkn w0t m8"].sample end
execute_userproblem(m)
click to toggle source
# File lib/Zeta/plugins/silly.rb, line 174 def execute_userproblem(m) m.reply ["user error.", "working as intended", "Status: WONTFIX", "PEBKAC issue", "ID:10T Error"].sample end
halloween(m, tz = nil)
click to toggle source
# File lib/Zeta/plugins/silly.rb, line 72 def halloween(m, tz = nil) tz ||= "-00:00" tz = tzparser(tz) begin today = Time.now.localtime(tz) hw = Time.new(today.year, 10, 31, 0, 0, 0, tz) hw = hw.next_year if hw.to_date.past? message = if hw.to_date == today.to_date "THIS IS HALLOWEEN!" else "There's #{ChronicDuration.output(hw.to_i - today.to_i, format: :long)} until Hallow's Eve!" end rescue ArgumentError => ae message = ae.message ensure m.reply message, true end end
heavymetalize(m, s)
click to toggle source
# File lib/Zeta/plugins/silly.rb, line 168 def heavymetalize(m, s) m.reply s.tr('AEIOUaeiouyYWwXx', 'ÄËÏÖÜäëïöüÿŸẄẅẌẍ') end
listen_poke(m, thebot)
click to toggle source
# File lib/Zeta/plugins/silly.rb, line 32 def listen_poke(m, thebot) if User(thebot) == @bot @pokers[m.user] = 0 if !@pokers.include?(m.user) @pokers[m.user] += 1 case @pokers[m.user] when 1..3 m.reply "Do NOT poke the bot!" when 4 m.reply "I said, do NOT poke the bot!" when 5 msg = ["WHAT ARE YOU, AN IDIOT? I SAID DO NOT POKE ME!!", "THIS! IS! SPARTA!!"].sample m.channel.kick m.user, ["WHAT ARE YOU, AN IDIOT? I SAID DO NOT POKE ME!!", "THIS! IS! SPARTA!!"].sample @pokers.delete(m.user) end end end
mayan(m)
click to toggle source
# File lib/Zeta/plugins/silly.rb, line 153 def mayan(m) msd = (Date.today.jd - Date.new(1, 1, 1).jd) + 1137142 lc = { baktun: (msd - (msd % 144000)) / 144000, katun: ((msd - (msd % 7200)) / 7200) % 20, tun: ((msd - (msd % 360)) / 360) % 20, uinal: ((msd - (msd % 20)) / 20) % 18, kin: (msd % 20) } m.reply '%<baktun>s.%<katun>s.%<tun>s.%<uinal>s.%<kin>s' % lc end
newyear(m, tz = nil)
click to toggle source
# File lib/Zeta/plugins/silly.rb, line 116 def newyear(m, tz = nil) tz ||= "-00:00" tz = tzparser(tz) begin today = Time.now.localtime(tz) nyear = Time.new(today.year.succ, 1, 1, 0, 0, 0, tz) #nyear = nyear.next_year if nyear.to_date.past? message = if nyear.to_date == today.to_date "Happy New Year #{today.year}!" else "There's #{ChronicDuration.output(nyear.to_i - today.to_i, format: :long)} until #{nyear.year}!" end rescue ArgumentError => ae message = ae.message ensure m.reply message, true end end
tz(m, tz = nil)
click to toggle source
# File lib/Zeta/plugins/silly.rb, line 138 def tz(m, tz = nil) tz ||= "-00:00" tz = tzparser(tz) begin today = Time.now.localtime(tz) message = today.to_s rescue ArgumentError => ae message = ae.message ensure m.reply message, true end end
tzparser(tz)
click to toggle source
# File lib/Zeta/plugins/silly.rb, line 57 def tzparser(tz) prefix = (tz[0] !~ /(\+|-)/ ? "+" : "") suffix = (tz =~ /^(?:\+|-)?(\d{1,2})$/ ? ":00" : "") regexp = /^(\+|-)?(\d{1,2})(?::(\d{1,2}))?$/ if tz =~ regexp prefix + tz.gsub(regexp) { |match| (!!$1 ? $1 : "") + $2.rjust(2, "0") + (!!$3 ? ":"+$3.rjust(2, "0") : "") } + suffix else raise ArgumentError, "A valid timezone was not supplied." end end
xmas(m, tz = nil)
click to toggle source
# File lib/Zeta/plugins/silly.rb, line 94 def xmas(m, tz = nil) tz ||= "-00:00" tz = tzparser(tz) begin today = Time.now.localtime(tz) xmas = Time.new(today.year, 12, 25, 0, 0, 0, tz) xmas = xmas.next_year if xmas.to_date.past? message = if xmas.to_date == today.to_date "Merry Christmas!" else "There's #{ChronicDuration.output(xmas.to_i - today.to_i, format: :long)} until Christmas!" end rescue ArgumentError => ae message = ae.message ensure m.reply message, true end end