Browse Source

Improve GBP leaderboard

- Add header
- User server nicknames
Frans Bergman 3 năm trước cách đây
mục cha
commit
7d0c0dba0a
1 tập tin đã thay đổi với 1 bổ sung1 xóa
  1. 1 1
      main.rb

+ 1 - 1
main.rb

@@ -248,7 +248,7 @@ end
 
 
 bot.command(:leaderboard, description: "Show who's got the most Good Boy Points (GBP).") do |_event|
 bot.command(:leaderboard, description: "Show who's got the most Good Boy Points (GBP).") do |_event|
     results = db.query "SELECT user_id, received FROM gbp ORDER BY received DESC"
     results = db.query "SELECT user_id, received FROM gbp ORDER BY received DESC"
-    results.each_with_index.map{|row, i| "#{i + 1}. #{bot.users[row[0]].username} - #{row[1]}"}.join("\n")
+    "**Good Boy Points (GBP) Leaderboard**\n" + results.each_with_index.map{|row, i| "#{i + 1}. #{_event.server.member(row[0]).nick} - #{row[1]}"}.join("\n")
 end
 end
 
 
 bot.voice_state_update() do |_event|
 bot.voice_state_update() do |_event|