mirror of
https://github.com/Rongronggg9/SlashBot.git
synced 2025-02-06 17:23:28 +08:00
use sender_chat
instead of forward_from_chat
as the sender of a channel message
This commit is contained in:
parent
8aa618cf6a
commit
6359928f03
@ -34,9 +34,10 @@ def find_name_by_username(username: str) -> str:
|
||||
|
||||
def get_user(msg):
|
||||
if msg['from']['id'] == TELEGRAM:
|
||||
return {'first_name': msg['forward_from_chat']['title'], 'id': msg['forward_from_chat']['id']}
|
||||
return {'first_name': msg['sender_chat']['title'], 'id': msg['sender_chat']['id'],
|
||||
'username': msg['sender_chat'].get('username')}
|
||||
elif msg['from']['id'] == GROUP:
|
||||
return {'first_name': msg['chat']['title'], 'id': msg['chat']['id']}
|
||||
return {'first_name': msg['chat']['title'], 'id': msg['chat']['id'], 'username': msg['chat'].get('username')}
|
||||
else:
|
||||
return msg['from']
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user