check if a user is authorized to use this bot :param update: :param context: :return:
(self, update, context)
| 239 | ) |
| 240 | |
| 241 | def _check_authorized(self, update, context): |
| 242 | """ |
| 243 | check if a user is authorized to use this bot |
| 244 | :param update: |
| 245 | :param context: |
| 246 | :return: |
| 247 | """ |
| 248 | if update.message.from_user.username != self.telegram_username: |
| 249 | self.__logger.warning( |
| 250 | "unauthorized access from {}".format(update.message.from_user) |
| 251 | ) |
| 252 | context.bot.send_message( |
| 253 | chat_id=update.message.chat_id, |
| 254 | text="You are not authorized to use this service \n", |
| 255 | ) |
| 256 | return False |
| 257 | else: |
| 258 | return True |
| 259 | |
| 260 | def _clean_web_hooks(self): |
| 261 | """ |
no test coverage detected