fix scoreboard missing variable for get_coin_count
This commit is contained in:
parent
3b2586bac1
commit
55ebc9856c
7
coin.rb
7
coin.rb
@ -26,7 +26,8 @@ def load_scoreboard()
|
||||
YAML::load_file(SCOREBOARD) || {}
|
||||
end
|
||||
|
||||
def get_coin_count(scoreboard, user)
|
||||
def get_coin_count(user)
|
||||
scoreboard = load_scoreboard()
|
||||
scoreboard[user] || 0
|
||||
end
|
||||
|
||||
@ -64,7 +65,7 @@ bot.message(content: 'GET COIN' ) do |event|
|
||||
|
||||
coin_state_active = false
|
||||
|
||||
coins = get_coin_count(scoreboard, event.author.id)
|
||||
coins = get_coin_count(event.author.id)
|
||||
event.respond "Nice catch, #{event.author.display_name}! You have #{plural('coin', coins)} now!"
|
||||
else
|
||||
event.respond "No coins for you, #{event.author.display_name}!"
|
||||
@ -72,7 +73,7 @@ bot.message(content: 'GET COIN' ) do |event|
|
||||
end
|
||||
|
||||
bot.message(with_text: '/coins') do |event|
|
||||
coins = get_coin_count(load_scoreboard(), event.author.id)
|
||||
coins = get_coin_count(event.author.id)
|
||||
event.respond "#{event.author.display_name}, you have #{plural('coin', coins)}!"
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user