File tree 2 files changed +9
-3
lines changed
2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ async def top_chat(update: Update, context: ContextTypes.DEFAULT_TYPE):
36
36
top_10 = sorted (ratings .items (), key = lambda x : x [1 ], reverse = True )[:10 ]
37
37
38
38
# format the response message
39
- response = " "
39
+ response = f"Top 10 players in { game_mode } : \n \n "
40
40
for i , (lichess_username , rating ) in enumerate (top_10 ):
41
41
response += f"{ i + 1 } . { lichess_username } : { rating } \n "
42
42
Original file line number Diff line number Diff line change 5
5
6
6
async def register (update : Update , context : ContextTypes .DEFAULT_TYPE ):
7
7
# Get the Telegram user ID and the Lichess username from the message
8
- telegram_id = update .effective_chat .id
8
+ telegram_id = update .effective_user .id
9
+
9
10
try :
10
11
lichess_username = context .args [0 ]
11
12
except Exception as error :
@@ -28,7 +29,12 @@ async def register(update: Update, context: ContextTypes.DEFAULT_TYPE):
28
29
await context .bot .send_message (chat_id = update .effective_chat .id , text = message )
29
30
30
31
async def stats (update : Update , context : ContextTypes .DEFAULT_TYPE ):
31
- stats_query = f'SELECT lichess_username FROM users WHERE telegram_id = { update .effective_chat .id } '
32
+ telegram_id = update .effective_user .id
33
+
34
+ if update .message .reply_to_message :
35
+ telegram_id = update .message .reply_to_message .from_user .id
36
+
37
+ stats_query = f'SELECT lichess_username FROM users WHERE telegram_id = { telegram_id } '
32
38
result = database_fetchone (stats_query )
33
39
34
40
if result is None :
You can’t perform that action at this time.
0 commit comments