forked from yagich/potomark-bot-rb
add sentence game
This commit is contained in:
parent
8829c57dd7
commit
ba2f91d620
23
bot.rb
23
bot.rb
@ -8,6 +8,8 @@ PIN_EMOJI = '📌'
|
||||
|
||||
TRIM_MESSAGE_LENGTH = 500
|
||||
|
||||
$sentence = {}
|
||||
|
||||
bot.reaction_add do |event|
|
||||
next unless [BOOKMARK_EMOJI, PIN_EMOJI].include? event.emoji.name
|
||||
|
||||
@ -57,4 +59,25 @@ bot.reaction_remove do |event|
|
||||
nil
|
||||
end
|
||||
|
||||
bot.message(in: Integer(ENV['SENTENCE_CHANNEL'])) do |event|
|
||||
if event.message.content == "."
|
||||
if $sentence.empty?
|
||||
next
|
||||
end
|
||||
event << "Congratulations, your sentence is: #{$sentence.values.join(" ").}"
|
||||
$sentence.clear
|
||||
next
|
||||
end
|
||||
|
||||
$sentence[event.message.id] = event.message.content
|
||||
end
|
||||
|
||||
bot.message_delete(in: Integer(ENV['SENTENCE_CHANNEL'])) do |event|
|
||||
$sentence.delete(event.id)
|
||||
end
|
||||
|
||||
bot.message_edit(in: Integer(ENV['SENTENCE_CHANNEL'])) do |event|
|
||||
$sentence[event.message.id] = event.message.content
|
||||
end
|
||||
|
||||
bot.run
|
||||
|
Loading…
Reference in New Issue
Block a user