def add_channel(bot: telegram.Bot,
update: telegram.Update):
if update.message.forward_from_chat:
if update.message.forward_from_chat.type != 'channel': # it seems forward_from_chat can only be channels
update.message.reply_text(
'Message type error. Please forward me a message from channel, or use /cancel to stop')
return
if update.message.forward_from_chat.id not in global_vars.filter_list['channels']:
global_vars.filter_list['channels'].append(update.message.forward_from_chat.id)
save_data()
update.message.reply_text('Okay, please send me another, or use /cancel to stop')
else:
update.message.reply_text('Already in list. Send me another or use /cancel to stop')
return CHANNEL
else:
if update.message.text == '/cancel':
update.message.reply_text('Done.')
return ConversationHandler.END
else:
update.message.reply_text(
'Message type error. Please forward me a message from channel, or use /cancel to stop')
return CHANNEL
_002_water_meter_control.py 文件源码
python
阅读 16
收藏 0
点赞 0
评论 0
评论列表
文章目录