![oz modic](/assets/img/avatar_default.png)
ACL: modify ACL perms Barf: silly test plug BotTools: join and part Circumstantial: excuses, success messages... Pastebin: paste module code to pastebin RawCmd: raw unix command line, and eval ruby code. requires super privilege Reminder: reminders reminders! URLInfo: output url info when url is detected Unixfun: figlet, cowsay, fortune. make sure u have them installed Voteage: user++, user--, :score user
52 lines
1.2 KiB
Ruby
52 lines
1.2 KiB
Ruby
require 'cinch'
|
|
require 'open-uri'
|
|
require_relative '../classes/Util.rb'
|
|
class BotTools
|
|
include Cinch::Plugin
|
|
include Hooks::ACLHook
|
|
include Util::PluginHelper
|
|
set :prefix, /^:/
|
|
@clist = %w{join part}
|
|
@@commands["join"] = ":join <channel> - join channel"
|
|
@@commands["part"] = ":part <channel> - part channel"
|
|
@@levelRequired = 10
|
|
match /join (#.+)/, method: :join;
|
|
match /part (#.+)/, method: :part;
|
|
|
|
def join(m, chan)
|
|
aclcheck(m)
|
|
if(!aclcheck(m))
|
|
m.reply("#{m.user.nick}: " + Util::Util.instance.getExcuse())
|
|
return
|
|
end
|
|
bot = Util::BotFamily.instance.get(Util::Util.instance.hton(m.bot.config.server)).bot
|
|
idx = bot.channels.find_index { |x| x.name == chan }
|
|
|
|
if(idx == nil)
|
|
bot.join(chan)
|
|
else
|
|
m.reply "already in #{chan}"
|
|
end
|
|
m.reply "joined #{chan}"
|
|
end
|
|
def part(m, chan)
|
|
aclcheck(m)
|
|
if(!aclcheck(m))
|
|
m.reply("#{m.user.nick}: " + Util::Util.instance.getExcuse())
|
|
return
|
|
end
|
|
ibot = Util::BotFamily.instance.get(Util::Util.instance.hton(m.bot.config.server)).bot
|
|
idx = bot.channels.find_index { |x| x.name == chan }
|
|
if(idx != nil)
|
|
m.reply "parting #{chan}"
|
|
bot.part(chan)
|
|
else
|
|
m.reply "not in #{chan}"
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|