From bd27f338916391c0b8a3e439975295d9871539e8 Mon Sep 17 00:00:00 2001 From: furtidev Date: Wed, 31 Jan 2024 05:06:32 +0600 Subject: [PATCH 1/2] ignore asdf config file --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 7a68328..22924d2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ vendor/* scoreboard.yml .env +.tool-versions \ No newline at end of file -- 2.30.2 From 0aba872fdf960199f42805fadab36d7f4e4ab49d Mon Sep 17 00:00:00 2001 From: furtidev Date: Wed, 31 Jan 2024 05:08:33 +0600 Subject: [PATCH 2/2] handling some TypeErrors --- coin.rb | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/coin.rb b/coin.rb index 4d19207..a735866 100644 --- a/coin.rb +++ b/coin.rb @@ -7,6 +7,7 @@ MAX_COINS_PER_DAY = 999 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"' +ITEMS = ["manga", "ramen", "pizza", "a cum jar"] COIN_EMOJI = '🪙' BAG_EMOJI = '💰' @@ -81,11 +82,21 @@ def get_coin(event, amt = 1) $coin_state_active = COIN_STATE_IDLE if(rand(100) == 47) hyper_coin_amount = rand(100) - coins = increment_coin(event.author.id, hyper_coin_amount) - event.respond "What astounding luck!!! #{clean_name author.display_name}, you've just activated HYPER COIN EVENT and have received #{hyper_coin_amount} coins for a grand total of #{coins} coins!" + begin + coins = increment_coin(event.author.id, hyper_coin_amount) + rescue TypeError + event.respond "An error occured. Your data was most likely tampered with. SUCH A SHAME that you missed out on the HYPER COIN EVENT!1!! You could've had #{hyper_coin_amount} coins at once." + else + event.respond "What astounding luck!!! #{clean_name author.display_name}, you've just activated HYPER COIN EVENT and have received #{hyper_coin_amount} coins for a grand total of #{coins} coins!" + end else - coins = increment_coin(author.id, amt) - event.respond "Nice catch, #{clean_name author.display_name}! You have #{plural('coin', coins)} now!" + begin + coins = increment_coin(author.id, amt) + rescue TypeError + event.respond "An error occurred. Your data was most likely tampered with. I'm going to buy #{ITEMS.sample} with this money now!" + else + event.respond "Nice catch, #{clean_name author.display_name}! You have #{plural('coin', coins)} now!" + end end else event.respond "No coins for you, #{clean_name author.display_name}!" -- 2.30.2