Added !orglist cancel

fix for !whois <char_id>
added logging for invalid ORG_MSG_EVENT's
This commit is contained in:
2022-05-09 19:47:26 +02:00
parent 3cade228fe
commit 43918066a9
8 changed files with 107 additions and 42 deletions
+10 -11
View File
@@ -112,9 +112,9 @@ class DiscordCommandHandler(BaseModule):
m = re.findall(r"<img src='tdb://id:GFX_GUI_ICON_PROFESSION_(\d+)'>", ctx)
for match in m:
ctx = ctx.replace(f"<img src='tdb://id:GFX_GUI_ICON_PROFESSION_{match}'>",
f"#_#{self.discord.util.get_profession(proficon.get(int(match)))}#_#")
f"<notice>{self.discord.util.get_profession(proficon.get(int(match)))}</notice>")
for x in ["`", ' *', ' _', ' |']:
for x in ["`", '*', '_', '|']:
ctx = ctx.replace(x, f' \\{x.strip()}')
for pattern, sub in [(r"(<br>|\n|</br>)", r"\n"),
(r"<highlight>(.*?)</highlight>", r"**\1**"),
@@ -138,7 +138,6 @@ class DiscordCommandHandler(BaseModule):
(r"<tab>", "\t"),
(r"\n\n<img src=(.?)rdb://\d+\1>", ''),
(r"<a href=skillid://\d+>(.+?)</a>", r'\1'),
('#(.+?)#', r'\1'),
('&lt;', '<'),
('&gt;', '>'),
(r"<font color=('*?).+?\1>", ''),
@@ -156,7 +155,7 @@ class DiscordCommandHandler(BaseModule):
@command(command="discord", params=[Const("invite")], access_level="member",
description="Get a personal Discord invite", sub_command="invite")
def discord_invite_cmd(self, request, _):
if not self.discord.client:
if not self.discord.client or not self.discord.client.loop:
return "Discord module has not been initiated yet. Please try again later."
account = self.discord.account_service.get_account(request.sender.char_id)
if account is None:
@@ -262,14 +261,14 @@ class DiscordCommandHandler(BaseModule):
account = self.discord.data.get_account_discord_id(member.id)
if not account:
log = '**%s** has left discord (**%s**)' % (member.nick or member.name, handle)
log = '<highlight>%s</highlight> has left discord (<highlight>%s</highlight>)' % (member.nick or member.name, handle)
self.relay_hub_service.send_message("system_logger", 0, log, log)
self.logger.info(log)
continue
main = self.discord.account_service.get_main(account.char_id)
if account is None:
continue
log = '**%s** has left discord (**%s**)' % (main.name, handle)
log = '<highlight>%s</highlight> has left discord (<highlight>%s</highlight>)' % (main.name, handle)
self.relay_hub_service.send_message("system_logger", 0, log, log)
self.logger.info(log)
# self.bot.send_private_channel_message("%s has left Discord (%s)" % (main.name, handle))
@@ -281,7 +280,7 @@ class DiscordCommandHandler(BaseModule):
invite_used = obj.invite
handle = member.name + "#" + member.discriminator
if invite_used is None:
log = '**%s** joined discord with unknown invite' % handle
log = '<highlight>%s</highlight> joined discord with unknown invite' % handle
self.relay_hub_service. \
send_message("system_logger", 0,
log + f" {self.get_role('Administrator', self.guild.roles).mention}'s, "
@@ -293,13 +292,13 @@ class DiscordCommandHandler(BaseModule):
self.discord.guild = self.discord.client.get_guild(self.discord.client.guilds[0].id)
account = self.discord.data.get_discord_invite(invite_used.code)
if account is None:
log = '**%s** joined discord with invite **%s** but couldnt find account!' % (
log = '<highlight>%s</highlight> joined discord with invite <highlight>%s</highlight> but couldnt find account!' % (
handle, invite_used.code)
self.relay_hub_service. \
send_message("system_logger", 0,
log + f" {self.get_role('Administrator', self.guild.roles).mention}'s, "
log + f" {self.discord.get_role('Administrator', self.discord.guild.roles).mention}'s, "
f"check that!",
log + f" {self.get_role('Administrator', self.guild.roles).mention}'s, "
log + f" {self.discord.get_role('Administrator', self.discord.guild.roles).mention}'s, "
f"check that!")
self.logger.info(log)
asyncio.run_coroutine_threadsafe(self.discord.discord_member_roles(member, None, None),
@@ -319,7 +318,7 @@ class DiscordCommandHandler(BaseModule):
self.discord.discord_member_roles(member, account, access_level),
self.discord.loop)
# noinspection LongLine
log = '**%s** joined discord with invite **%s** and matches account **%s**' \
log = '<highlight>%s</highlight> joined discord with invite <highlight>%s</highlight> and matches account <highlight>%s</highlight>' \
% (handle, invite_used.code,
f"{f'[{self.discord.alias_controller.get_alias(main.org_id)}] ' if self.discord.setting_service.get_value('is_alliance_bot') == '1' else ''}{main.name}")
self.relay_hub_service.send_message("system_logger", account.main, log, log)