[telegram] Add support for help command
This commit is contained in:
parent
d92fd7dd6f
commit
d5c8eb628d
|
@ -32,6 +32,7 @@ class TelegramBot(Censor):
|
||||||
dp = Dispatcher(self.bot)
|
dp = Dispatcher(self.bot)
|
||||||
dp.register_message_handler(self._send_welcome, commands=['start'])
|
dp.register_message_handler(self._send_welcome, commands=['start'])
|
||||||
dp.register_message_handler(self._remove_user, commands=['stop'])
|
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)
|
dp.register_message_handler(self._receive_message)
|
||||||
return dp
|
return dp
|
||||||
|
|
||||||
|
@ -118,6 +119,12 @@ class TelegramBot(Censor):
|
||||||
except NoMatch:
|
except NoMatch:
|
||||||
await message.reply('Error: You are not subscribed to this bot.')
|
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):
|
async def _receive_message(self, message: types.Message):
|
||||||
if not message.text:
|
if not message.text:
|
||||||
await message.reply('Error: Only text messages are allowed.')
|
await message.reply('Error: Only text messages are allowed.')
|
||||||
|
|
Loading…
Reference in a new issue