Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.command_conv = ConversationHandler(
entry_points=[],
states={Flags.COMMAND_PENDING: [CallbackQueryHandler(self.command_exec)]},
fallbacks=[CallbackQueryHandler(self.bot.session_expired)],
per_message=True,
per_chat=True,
per_user=False
)
self.bot.dispatcher.add_handler(self.command_conv)
self.modules_list: List[Any[SlaveChannel, Middleware]] = []
for i in sorted(coordinator.slaves.keys()):
self.modules_list.append(coordinator.slaves[i])
self.modules_list.extend(coordinator.middlewares)
def reply_message(self, message: EFBMsg, text: str):
reply = EFBMsg()
reply.text = text
reply.chat = coordinator.slaves[message.chat.channel_id].get_chat(message.chat.chat_uid)
reply.author = self.chat
reply.type = MsgType.Text
reply.deliver_to = coordinator.master
reply.target = message
reply.uid = str(uuid.uuid4())
coordinator.send_message(reply)
the module_id, chat_id and group_id specified.
"""
key = (module_id, chat_id)
if key in self.cache:
return self.cache[key]
c_log = self.db.get_slave_chat_info(module_id, chat_id)
if c_log is not None and c_log.pickle:
# Suppress AttributeError caused by change of class name in EFB 2.0.0b26, ETM 2.0.0b40
with suppress(AttributeError):
obj = unpickle(c_log.pickle, self.db)
self.enrol(obj)
return obj
# Only look up from slave channels as middlewares don’t have get_chat_by_id method.
if module_id in coordinator.slaves:
with suppress(EFBChatNotFound, KeyError):
chat_obj = coordinator.slaves[module_id].get_chat(chat_id)
return self.compound_enrol(chat_obj)
if build_dummy:
return ETMSystemChat(self.db,
module_id=module_id,
module_name=module_id,
uid=chat_id,
name=chat_id)
return None
def info_general(self):
"""Generate string for information of the current running EFB instance."""
if self.instance_id:
if coordinator.profile != "default":
msg = self._(
"This is EFB Telegram Master Channel {version}, running on profile “{profile}”, "
"instance “{instance}”, on EFB {fw_version}.")
else: # Default profile
msg = self._(
"This is EFB Telegram Master Channel {version}, running on default profile, "
"instance “{instance}”, on EFB {fw_version}.")
else: # Default instance
if coordinator.profile != "default":
msg = self._(
"This is EFB Telegram Master Channel {version}, running on profile “{profile}”, "
"default instance, on EFB {fw_version}.")
else: # Default profile
msg = self._(
"This is EFB Telegram Master Channel {version}, running on default profile and instance, "
"on EFB {fw_version}.")