diff --git a/kibicara/platforms/telegram/bot.py b/kibicara/platforms/telegram/bot.py index 2bbd550..3f5c9a2 100644 --- a/kibicara/platforms/telegram/bot.py +++ b/kibicara/platforms/telegram/bot.py @@ -32,6 +32,9 @@ class TelegramBot(Censor): self.bot = Bot(token=self.telegram_model.api_token) self.dp = self._create_dispatcher() logger.debug(f'Bot {self.telegram_model.hood.name} starting.') + user = await self.bot.get_me() + if user.username: + await self.telegram_model.update(username=user.username) await gather(self.dp.start_polling(), self._push()) except CancelledError: logger.debug(f'Bot {self.telegram_model.hood.name} received Cancellation.') diff --git a/kibicara/platforms/telegram/model.py b/kibicara/platforms/telegram/model.py index 16bc053..a5beae1 100644 --- a/kibicara/platforms/telegram/model.py +++ b/kibicara/platforms/telegram/model.py @@ -11,6 +11,7 @@ class Telegram(Model): hood: ForeignKey(Hood) api_token: Text(unique=True) welcome_message: Text() + username: Text(allow_null=True) = None enabled: Boolean() = True class Mapping(Mapping):