if message.chat_attrs: set_egress_message_id(src_platform=message.chat_attrs.platform, src_chat_id=message.chat_attrs.chat_id, src_chat_type=message.chat_attrs.chat_type, src_message_id=message.chat_attrs.message_id, dst_platform=self.name, dst_chat_id=to_chat, dst_chat_type=chat_type, dst_message_id=egress_message.messageId, user_id=self.qq) async def is_group_admin(self, chat_id: int, chat_type: ChatType, user_id: int): if chat_type != ChatType.GROUP: return False return False async def is_group_owner(self, chat_id: int, chat_type: ChatType, user_id: int): if chat_type != ChatType.GROUP: return False return False def handle_exception(self, loop, context): # context["message"] will always be there; but context["exception"] may not msg = context.get("exception", context["message"]) self.logger.exception('Unhandled exception: ', exc_info=msg) UMRDriver.register_driver('Mirai', MiraiDriver)
if self.reply_token[to_chat]: await self.bot.reply_message(reply_token=self.reply_token[to_chat], messages=_message) else: await self.bot.push_message(to=to_chat, messages=_message) if message.chat_attrs: set_egress_message_id(src_platform=message.chat_attrs.platform, src_chat_id=message.chat_attrs.chat_id, src_chat_type=message.chat_attrs.chat_type, src_message_id=message.chat_attrs.message_id, dst_platform=self.name, dst_chat_id=to_chat, dst_chat_type=_chat_type, dst_message_id=self.message_id, # useless message id user_id=0) def handle_exception(self, loop, context): # e = context.get('exception') # if isinstance(e, SSLError): # return msg = context.get("exception", context["message"]) self.logger.exception('Unhandled exception: ', exc_info=msg) async def is_group_admin(self, chat_id: int, chat_type: ChatType, user_id: int): return False async def is_group_owner(self, chat_id: int, chat_type: ChatType, user_id: int): return False UMRDriver.register_driver('Line', LineDriver)
unified_message.text += qq_emoji_list[qq_face] else: unified_message.text += '\u2753' # ❓ else: self.logger.debug(f'Unhandled message type: {str(m)} with type: {message_type}') message_list.append(unified_message) return message_list async def is_group_admin(self, chat_id: int, chat_type: ChatType, user_id: int): if chat_type != ChatType.GROUP: return False if chat_id not in self.group_list: return False return self.group_list[chat_id][user_id]['role'] in ('owner', 'admin') async def is_group_owner(self, chat_id: int, chat_type: ChatType, user_id: int): if chat_type != ChatType.GROUP: return False if chat_id not in self.group_list: return False return self.group_list[chat_id][user_id]['role'] == 'owner' def handle_exception(self, loop, context): # context["message"] will always be there; but context["exception"] may not msg = context.get("exception", context["message"]) self.logger.exception('Unhandled exception: ', exc_info=msg) UMRDriver.register_driver('QQ', QQDriver)
self.get_chat_attributes(message.reply_to_message, chat_attrs.reply_to) async def is_group_admin(self, chat_id: int, chat_type: ChatType, user_id: int): if chat_type != ChatType.GROUP: return False member = await self.bot.get_chat_member(chat_id, user_id) if member: if member.status in ('creator', 'administrator'): return True return False async def is_group_owner(self, chat_id: int, chat_type: ChatType, user_id: int): if chat_type != ChatType.GROUP: return False member = await self.bot.get_chat_member(chat_id, user_id) if member: if member.status == 'creator': return True return False def handle_exception(self, loop, context): # context["message"] will always be there; but context["exception"] may not msg = context.get("exception", context["message"]) self.logger.exception('Unhandled exception: ', exc_info=msg) UMRDriver.register_driver('Telegram', TelegramDriver)
message_text += unparse_entities_to_markdown(message, EntityType.PLAIN | EntityType.BOLD | EntityType.ITALIC | EntityType.CODE | EntityType.STRIKETHROUGH | EntityType.UNDERLINE | EntityType.CODE_BLOCK | EntityType.QUOTE | EntityType.QUOTE_BLOCK) if message.image: assert isinstance(channel, discord.TextChannel) outbound_message = await channel.send(content=message_text, file=discord.File(message.image)) else: outbound_message = await channel.send(content=message_text) if message.chat_attrs: set_egress_message_id(src_platform=message.chat_attrs.platform, src_chat_id=message.chat_attrs.chat_id, src_chat_type=message.chat_attrs.chat_type, src_message_id=message.chat_attrs.message_id, dst_platform=self.name, dst_chat_id=to_chat, dst_chat_type=chat_type, dst_message_id=outbound_message.id, # useless message id user_id=0) def handle_exception(self, loop, context): # context["message"] will always be there; but context["exception"] may not msg = context.get("exception", context["message"]) self.logger.exception('Unhandled exception: ', exc_info=msg) UMRDriver.register_driver('Discord', DiscordDriver)