fixed a bug in the discord account getter

fixed !lastseen on discord, aswell as multi-page responses
This commit is contained in:
2022-05-14 17:39:18 +02:00
parent 72ccd475af
commit e942ac43fa
7 changed files with 17 additions and 12 deletions
@@ -92,10 +92,10 @@ class DiscordCommandHandler(BaseModule):
body = self.discord.text.split_by_separators(embeds.description, 4000, 10)
tmp1 = embeds
embeds = []
for x in enumerate(body):
for x, e in enumerate(body):
tmp = tmp1.copy()
tmp.description = body[x]
tmp.title += f"*Page ({x}/{len(body)}*"
tmp.description = e
tmp.title += f"*Page ({x}/{len(body)})*"
embeds.append(tmp)
else:
embeds = [embeds]
+2 -1
View File
@@ -186,8 +186,9 @@ class DiscordController:
elif type(msg) == ChatBlob:
if msg.embed:
msg: ChatBlob
des = self.cmd.parseDiscord(msg.msg, blob=True)
blob = Embed(title=self.cmd.parseDiscord(f"{msg.page_prefix} {msg.title} {msg.page_postfix}"),
color=0x00FF00, description=self.cmd.parseDiscord(msg.msg, blob=True).replace("\n> ", '\n'))
color=0x00FF00, description=(des or "").replace("\n> ", '\n'))
asyncio.run_coroutine_threadsafe(ch.send("", delete_after=del_after, embed=blob), self.loop)
return
rsp = self.cmd.parseDiscord(ctx.formatted_message.page_prefix) + "\n"
+2 -3
View File
@@ -18,8 +18,7 @@ class DiscordData:
return self.db.exec("UPDATE account SET discord_handle = ? WHERE discord_id = ?", [handle, discord_id])
def get_discord_invite(self, invite):
return self.db.query_single("SELECT * FROM account WHERE discord_invite = ?", [invite])
return self.db.query_single("SELECT * FROM account WHERE discord_invite = ? and a.main=a.char_id", [invite])
def get_account_discord_id(self, discord_id):
return self.db.query_single(
"SELECT * FROM account a left join player p on a.char_id=p.char_id WHERE discord_id = ?", [discord_id])
return self.db.query_single("SELECT * FROM account a left join player p on a.char_id=p.char_id WHERE a.discord_id = ? and a.main=a.char_id", [discord_id])