[telegram] Add support for help command

This commit is contained in:
Martin Rey 2020-10-12 13:35:41 +02:00
parent d92fd7dd6f
commit d5c8eb628d
Signed by untrusted user who does not match committer: mrey
GPG key ID: 4EAFAF039839B334

View file

@ -32,6 +32,7 @@ class TelegramBot(Censor):
dp = Dispatcher(self.bot)
dp.register_message_handler(self._send_welcome, commands=['start'])
dp.register_message_handler(self._remove_user, commands=['stop'])
dp.register_message_handler(self._send_help, commands=['help'])
dp.register_message_handler(self._receive_message)
return dp
@ -118,6 +119,12 @@ class TelegramBot(Censor):
except NoMatch:
await message.reply('Error: You are not subscribed to this bot.')
async def _send_help(self, message: types.Message):
if message.from_user.is_bot:
await message.reply('Error: Bots can\'t be helped.')
return
await message.reply('Send messages here to broadcast them to your hood')
async def _receive_message(self, message: types.Message):
if not message.text:
await message.reply('Error: Only text messages are allowed.')