Allow the bot to specify the original sender
This commit is contained in:
parent
fb6b86128d
commit
7c6409e626
|
@ -30,6 +30,7 @@ makedirs(CHAT_PATH+'/data', exist_ok=True)
|
||||||
|
|
||||||
# user returned
|
# user returned
|
||||||
OWNER_ID = config['user_returned']['owner_id']
|
OWNER_ID = config['user_returned']['owner_id']
|
||||||
|
SEND_SENDER = config['user_returned'].getboolean('send_sender')
|
||||||
REDIRECT_MSG = config['user_returned']['redirect_msg']
|
REDIRECT_MSG = config['user_returned']['redirect_msg']
|
||||||
|
|
||||||
# internal
|
# internal
|
||||||
|
|
|
@ -27,5 +27,7 @@ chat_path:
|
||||||
|
|
||||||
[user_returned]
|
[user_returned]
|
||||||
owner_id:
|
owner_id:
|
||||||
|
# Whether the bot must send a message specifing the sender before forwarding
|
||||||
|
send_sender: false
|
||||||
# The message to send to users contacting the bot
|
# The message to send to users contacting the bot
|
||||||
redirect_msg = The user is back. You can can contact him directly now.
|
redirect_msg = The user is back. You can can contact him directly now.
|
||||||
|
|
|
@ -28,11 +28,12 @@ async def user_back(update, context):
|
||||||
chat_id=update.effective_chat.id,
|
chat_id=update.effective_chat.id,
|
||||||
reply_to_message_id=update.effective_message.id,
|
reply_to_message_id=update.effective_message.id,
|
||||||
text=REDIRECT_MSG)
|
text=REDIRECT_MSG)
|
||||||
sender = USER_NAMES[str(update.effective_chat.id)]
|
if SEND_SENDER:
|
||||||
await context.bot.send_message(
|
sender = USER_NAMES[str(update.effective_chat.id)]
|
||||||
chat_id=OWNER_ID,
|
await context.bot.send_message(
|
||||||
text=f'*Message from {sender}:*',
|
chat_id=OWNER_ID,
|
||||||
parse_mode='MarkdownV2')
|
text=f'*Message from {sender}:*',
|
||||||
|
parse_mode='MarkdownV2')
|
||||||
await context.bot.forward_message(
|
await context.bot.forward_message(
|
||||||
chat_id=OWNER_ID,
|
chat_id=OWNER_ID,
|
||||||
from_chat_id=update.effective_chat.id,
|
from_chat_id=update.effective_chat.id,
|
||||||
|
|
Reference in New Issue