make bot multi-channel

This commit is contained in:
Emily 2021-08-29 12:38:36 +02:00
parent 52b096a53b
commit 102631085e
2 changed files with 10 additions and 8 deletions

View file

@ -1,4 +1,4 @@
#!/usr/bin/ruby
TOKEN = "YOUR_TOKEN_HERE"
CHANNEL = 402826623583256589
TOKEN = "YOUR_TOKEN_HERE"
CHANNELS = [ 536907792859267083, 560880728796168221 ]

View file

@ -9,16 +9,18 @@ bot = Discordrb::Bot.new token: TOKEN
$messages = Set.new
bot.ready do |event|
chan = bot.channel CHANNEL
chan = bot.channel CHANNELS[0]
bot.online
bot.watching = "Messages in #" + chan.name
end
bot.message(in: CHANNEL) do |event|
if $messages.include? event.content then
event.message.delete "ROBOT9000 strikes again!"
else
$messages << event.content
bot.message do |event|
if CHANNELS.include? event.channel.id then
if $messages.include? event.content then
event.message.delete "r9k"
else
$messages << event.content
end
end
end