5 Commits

Author SHA1 Message Date
yagich ac30629979 fix bad math result spam 2023-05-13 19:27:27 +03:00
mud 3c3815defb FIX AWFUL BUG 2023-05-09 21:39:12 +00:00
mud 06d44e564f fix missing global variable token 2023-05-09 16:03:33 +02:00
mud caaf419d6d send block gif for math questions 2023-05-09 13:38:32 +02:00
mud d548e00fb3 Merge pull request 'cryptobanky' (#4) from yagich/bankerbot-rb:feat/cryptobanky into main
Reviewed-on: mud/bankerbot-rb#4
2023-05-09 11:37:03 +00:00
2 changed files with 4 additions and 3 deletions
BIN
View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 305 KiB

+4 -3
View File
@@ -74,7 +74,7 @@ def get_coin(event, amt = 1)
# update score # update score
author = event.methods.include?(:author) ? event.author : event.user author = event.methods.include?(:author) ? event.author : event.user
if $coin_state_active if $coin_state_active != 0
if author.bot_account? if author.bot_account?
event.respond "Bots don't get coins!" event.respond "Bots don't get coins!"
end end
@@ -167,7 +167,7 @@ bot.message(in: Integer(ENV['BOT_CHANNEL'])) do |event|
if result == user_result if result == user_result
get_coin(event, MATH_PROBLEM_COIN_GAIN) get_coin(event, MATH_PROBLEM_COIN_GAIN)
else elsif user_result.is_a? Integer
event.respond "Nice try, but you're wrong!" event.respond "Nice try, but you're wrong!"
end end
end end
@@ -188,7 +188,8 @@ loop do
$mathproblem_operator = rand(2) == 1 ? "+" : "-" $mathproblem_operator = rand(2) == 1 ? "+" : "-"
# send the math problem # send the math problem
bot.send_message(ENV['BOT_CHANNEL'], "Solve the following for #{MATH_PROBLEM_COIN_GAIN} coins: `#{$mathproblem_op1} #{$mathproblem_operator} #{mathproblem_op2}`") bot.send_file(ENV['BOT_CHANNEL'], File.open('./block.gif', 'r'))
bot.send_message(ENV['BOT_CHANNEL'], "Solve the following for #{MATH_PROBLEM_COIN_GAIN} coins: `#{$mathproblem_op1} #{$mathproblem_operator} #{$mathproblem_op2}`")
else else
# activate coin state # activate coin state
$coin_state_active = COIN_STATE_ACTIVE $coin_state_active = COIN_STATE_ACTIVE