diff --git a/cogs/playlist.py b/cogs/playlist.py index 5b37fe4..93656c1 100644 --- a/cogs/playlist.py +++ b/cogs/playlist.py @@ -314,7 +314,7 @@ class Playlists(commands.Cog, name="playlist"): return await ctx.send(get_lang(ctx.guild.id, 'inboxNoMsg'), ephemeral=True) inbox = user['inbox'].copy() - view = InboxView(ctx.author.name, user['inbox']) + view = InboxView(ctx.author, user['inbox']) message = await ctx.send(embed=view.build_embed(), view=view, ephemeral=True) view.response = message await view.wait() diff --git a/views/inbox.py b/views/inbox.py index a2d2780..49b42dd 100644 --- a/views/inbox.py +++ b/views/inbox.py @@ -40,7 +40,7 @@ class Select_message(discord.ui.Select): class InboxView(discord.ui.View): def __init__(self, author, inbox): super().__init__(timeout=60) - self.author = author + self.author: discord.Member = author self.inbox = inbox self.response = None self.newplaylist = [] @@ -48,13 +48,13 @@ class InboxView(discord.ui.View): self.current = None self.add_item(Select_message(inbox)) - async def interaction_check(self, interaction): + async def interaction_check(self, interaction: discord.Interaction): if interaction.user == self.author: return True return False - + def build_embed(self): - embed=discord.Embed(title=f"📭 All {self.author}'s Inbox", + embed=discord.Embed(title=f"📭 All {self.author.name}'s Inbox", description=f'Max Messages: {len(self.inbox)}/10' + '```%0s %2s %20s\n' % (" ", "ID:", "Title:") + '\n'.join('%0s %2s. %35s'% ('✉️' if mail['type'] == 'invite' else '📢', index, mail['title'][:35] + "...") for index, mail in enumerate(self.inbox, start=1)) + '```', color=func.settings.embed_color) if self.current: diff --git a/web/static/js/objects.js b/web/static/js/objects.js index bb50710..b8ff078 100644 --- a/web/static/js/objects.js +++ b/web/static/js/objects.js @@ -35,11 +35,12 @@ class DataInput { constructor(bytes) { if (typeof bytes === "string") { - var decodedString = atob(bytes); - var bytes = new Uint8Array(decodedString.length); + const decodedString = atob(bytes); + const byteArr = new Uint8Array(decodedString.length); for (let i = 0; i < decodedString.length; i++) { - bytes[i] = decodedString.charCodeAt(i); + byteArr[i] = decodedString.charCodeAt(i); } + bytes = byteArr; } this.#buf = bytes; this.#view = new DataView(bytes.buffer); @@ -47,7 +48,7 @@ class DataInput { #_advance(bytes) { if (this.#pos + bytes > this.#buf.length) { - throw new Error(""); + throw new Error("Buffer overflow: cannot advance further."); } const p = this.#pos; this.#pos += bytes; @@ -59,7 +60,7 @@ class DataInput { } readBoolean() { - return this.readByte() + return this.readByte() !== 0; } readUnsignedShort() {