mirror of
https://github.com/Rongronggg9/SlashBot.git
synced 2025-02-06 17:23:28 +08:00
add '自己' support
This commit is contained in:
parent
3535989ac1
commit
7f4eb9aac8
12
SlashBot.py
12
SlashBot.py
@ -21,13 +21,17 @@ def reply(update, context):
|
|||||||
msg = update.to_dict()['message']
|
msg = update.to_dict()['message']
|
||||||
msg_from = msg['from']
|
msg_from = msg['from']
|
||||||
command = msg['text'].lstrip('/')
|
command = msg['text'].lstrip('/')
|
||||||
if 'reply_to_message' in msg.keys():
|
|
||||||
|
if 'reply_to_message' in msg.keys() and msg['reply_to_message']['from'] != msg_from:
|
||||||
msg_rpl = msg['reply_to_message']['from']
|
msg_rpl = msg['reply_to_message']['from']
|
||||||
else:
|
else:
|
||||||
msg_rpl = msg_from
|
msg_rpl = {'first_name': '自己', 'id': msg_from['id']}
|
||||||
|
|
||||||
update.effective_message.reply_text(f'{mention(msg_from)} {command} 了 {mention(msg_rpl)}!',
|
mention_from = mention(msg_from)
|
||||||
parse_mode='Markdown')
|
mention_rpl = mention(msg_rpl)
|
||||||
|
text = f"{mention_from} {command} 了 {mention_rpl}!"
|
||||||
|
|
||||||
|
update.effective_message.reply_text(text, parse_mode='Markdown')
|
||||||
|
|
||||||
|
|
||||||
updater = Updater(token=Token, use_context=True)
|
updater = Updater(token=Token, use_context=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user