Skip to content

Instantly share code, notes, and snippets.

@AwwCookies
Created February 8, 2015 02:44
Show Gist options
  • Save AwwCookies/cdd217c4d546ec8b077b to your computer and use it in GitHub Desktop.
Save AwwCookies/cdd217c4d546ec8b077b to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require "json"
require "./plugins/ruby/peppermint.rb"
data, config = Peppermint.get_dc(ARGV)
hosts = Peppermint.load("op")
# Admin Host
Aww = ["[email protected]", "[email protected]"]
ADMINS = {
"*" => Aww,
"##Aww-Bots" => Aww,
"##Aww" => Aww
}
if ADMINS.has_key? data["Channel"]
if data["Type"] == "PRIVMSG" and ADMINS[data["Channel"]].include? data["Host"] or ADMINS["*"].include? data["Host"]
args = data["Message"].split(' ')
nick = args[1] ? args[1] : data["Nick"]
if args[0] == "~op"
Peppermint::op(data["Channel"], nick)
end
if args[0] == "~deop"
Peppermint::deop(data["Channel"], nick)
end
if args[0] == "~voice"
Peppermint::op(data["Channel"], nick)
end
if args[0] == "~devoice"
Peppermint::op(data["Channel"], nick)
end
if args[0] == "~ban"
if hosts.has_key? args[1]
host = hosts[args[1]]
else
host = args[1]
end
if host.start_with? "$"
Peppermint::ban(data["Channel"], host)
else
Peppermint::ban(data["Channel"], "*!*@" + host)
end
end
if args[0] == "~unban"
if hosts.has_key? args[1]
host = hosts[args[1]]
else
host = args[1]
end
if host.start_with? "$"
Peppermint::unban(data["Channel"], host)
else
Peppermint::unban(data["Channel"], "*!*@" + host)
end
end
if ["~mute", "~stfu"].include? args[0]
if hosts.has_key? args[1]
host = hosts[args[1]]
else
host = args[1]
end
if host.start_with? "$"
Peppermint::mute(data["Channel"], host)
else
Peppermint::mute(data["Channel"], "*!*@" + host)
end
end
if args[0] == "~unmute"
if hosts.has_key? args[1]
host = hosts[args[1]]
else
host = args[1]
end
if host.start_with? "$"
Peppermint::unmute(data["Channel"], host)
else
Peppermint::unmute(data["Channel"], "*!*@" + host)
end
end
if args[0] == "~kick"
msg = args[2] ? args[2..args.size].join(' ') : "GTFO"
Peppermint::kick(data["Channel"], args[1], msg)
end
end
end
if ["PRIVMSG", "JOIN", "PART"].include? data["Type"]
hosts[data["Nick"]] = data["Host"].split("@")[1]
Peppermint.save("op", hosts)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment