Compare commits

...

2 Commits

Author SHA1 Message Date
b24afe7b80
give coin with react 2022-11-07 15:20:44 +03:00
899a496f14 Merge pull request 'sync w/main' (#1) from mud/bankerbot-rb:main into main
Reviewed-on: #1
2022-11-07 11:56:05 +00:00

20
coin.rb
View File

@ -8,6 +8,7 @@ COIN_TIMEOUT = 15
SCOREBOARD = './scoreboard.yml'
DUMBASS = 521596582962003968
DUMBASS_BOT = 1034966228755820575
COIN_EMOJI = '🪙'
coin_state_active = false
coins_offered_today = 0
@ -98,6 +99,25 @@ bot.message(from: DUMBASS_BOT) do |event|
end
bot.reaction_add do |event|
next unless event.emoji.name == COIN_EMOJI
reactor_coins = get_coin_count(event.user.id)
if reactor_coins == 0
event.respond("<@#{event.user.id}>, you're a poor shmuck!")
next
end
if event.message.author == event.user
event.respond("<@#{event.user.id}>, you can't give coins to yourself!")
next
end
increment_coin(event.message.author.id)
increment_coin(event.user.id, -1)
event.respond "<@#{event.message.author.id}>, you have been given a coin by <@#{event.user.id}>!"
end
bot.run(true)
loop do