Skip to content

Commit

Permalink
Add first version of plugin Anarchism
Browse files Browse the repository at this point in the history
    For now it gives +o to all newly connected users
  • Loading branch information
Emeraude committed Jan 14, 2018
1 parent 066324b commit f24ac43
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/DashBot.cr
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ module DashBot
Plugins::Reminder.bind(bot)
Plugins::Rpg.bind(bot)
Plugins::Random.bind(bot)
Plugins::Anarchism.bind(bot)

bot.on_ready do
bot.join (ARGV.empty? ? ["#equilibre"] : ARGV).map { |chan| Crirc::Protocol::Chan.new(chan) }
Expand Down
15 changes: 15 additions & 0 deletions src/DashBot/plugins/anarchism.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
module DashBot::Plugins::Anarchism
extend self

def bind(bot)
bind_new_user bot
end

def bind_new_user(bot)
bot.on("JOIN") do |msg, _|
chan = Crirc::Protocol::Chan.new msg.message.to_s
user = Crirc::Protocol::User.new msg.source.source_nick
bot.mode chan, "+o", user
end
end
end

0 comments on commit f24ac43

Please sign in to comment.