add money bag give coin function

This commit is contained in:
mud mud 2023-02-14 12:21:32 +01:00
parent 8245932e33
commit 4492dae059
Signed by untrusted user: mud
GPG Key ID: D29C9385CC54F61C

15
coin.rb
View File

@ -8,6 +8,7 @@ COIN_TIMEOUT = 15
SCOREBOARD = './scoreboard.yml'
PASTA='You know what? Im done, i am leaving, we were friendly talking about the subject. This crossed the line of "ok killer of joy" to "no fun allowed"'
COIN_EMOJI = '🪙'
BAG_EMOJI = '💰'
$coin_state_active = false
$coins_offered_today = 0
@ -93,8 +94,16 @@ def give_coin(event)
return
end
increment_coin(event.message.author.id)
increment_coin(event.user.id, -1)
coin_amount = 0
if event.emoji.name == COIN_EMOJI
coin_amount = 1
elsif event.emoji.name == BAG_EMOJI
coin_amount = 20
end
increment_coin(event.message.author.id, coin_amount)
increment_coin(event.user.id, -coin_amount)
event.respond "How nice! <@#{event.message.author.id}> has received a coin from <@#{event.user.id}>!"
end
@ -125,7 +134,7 @@ event.respond "OHHHHHH IM GONNA CUM"
end
bot.reaction_add do |event|
next unless event.emoji.name == COIN_EMOJI
next unless [COIN_EMOJI, BAG_EMOJI].include? event.emoji.name
if event.message.author.id == bot.bot_application.id
get_coin(event)