Skip to content

Commit

Permalink
count attachments and minor formatting fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Ast3risk-ops committed Dec 29, 2024
1 parent a65e0e6 commit 29ae3d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
7 changes: 5 additions & 2 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ async def on_ready():

class TagSet(discord.ui.Modal):
def __init__(self, *args, **kwargs) -> None:
super().__init__(title="Message Tag(s)")
super().__init__(timeout=None, *args, **kwargs)
# Modal for tag input
self.add_item(discord.ui.InputText(label="", required=False))
async def callback(self, interaction: discord.Interaction):
Expand Down Expand Up @@ -116,7 +116,7 @@ async def bookmark_tag(
ctx,
message: discord.Message
):
modal = TagSet()
modal = TagSet(title="Message Tag(s)")
await ctx.send_modal(modal)
await modal.wait() # Wait for the modal to be submitted before archiving
reactionlist = [] # Empty list of reactions to use later
Expand Down Expand Up @@ -147,6 +147,9 @@ async def bookmark_tag(
if message.embeds:
numembeds = len(message.embeds) # Number of embeds
embed.add_field(name="<:mdicardtext:1311825458480021596> Embeds", value=f"{numembeds}", inline=True)
if message.attachments:
numfiles = len(message.attachments)
embed.add_field(name="<:mdifiledownload:1322695880637284514> Attachments", value=f"{numfiles}", inline=True)
embed.add_field(name="<:mdicalendar:1311544097240121384> Send Date", value=f"{discord.utils.format_dt(message.created_at, 'F')}", inline=True)
if modal.children[0].value:
embed.add_field(name="<:mditag:1311505882047189012> Tags", value=f"{modal.children[0].value}", inline=True)
Expand Down
9 changes: 5 additions & 4 deletions main_emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ async def on_ready():

class TagSet(discord.ui.Modal):
def __init__(self, *args, **kwargs) -> None:
super().__init__(title="Message Tag(s)")
super().__init__(timeout=None, *args, **kwargs)
# Modal for tag input
self.add_item(discord.ui.InputText(label="", required=False))
async def callback(self, interaction: discord.Interaction):
Expand All @@ -48,7 +48,6 @@ async def callback(self, interaction: discord.Interaction):

# Edit the original message with the updated embed
await interaction.response.edit_message(embed=embed)
return
class DeleteBookmark(discord.ui.View):
def __init__(self):
super().__init__(timeout=None)
Expand All @@ -72,7 +71,6 @@ async def customizer(self, button, interaction):
class About(discord.ui.View):
def __init__(self):
super().__init__(timeout=None)

SiteButton = discord.ui.Button(label='Website', style=discord.ButtonStyle.url, url='https://archiver.asterisk.lol')
self.add_item(SiteButton)
CodeButton = discord.ui.Button(label='Source Code', style=discord.ButtonStyle.url, url='https://github.com/Ast3risk-ops/archiver')
Expand Down Expand Up @@ -118,7 +116,7 @@ async def bookmark_tag(
ctx,
message: discord.Message
):
modal = TagSet()
modal = TagSet(title="Message Tag(s)")
await ctx.send_modal(modal)
await modal.wait() # Wait for the modal to be submitted before archiving
reactionlist = [] # Empty list of reactions to use later
Expand Down Expand Up @@ -149,6 +147,9 @@ async def bookmark_tag(
if message.embeds:
numembeds = len(message.embeds) # Number of embeds
embed.add_field(name="🔲 Embeds", value=f"{numembeds}", inline=True)
if message.attachments:
numfiles = len(message.attachments)
embed.add_field(name="📸 Attachments", value=f"{numfiles}", inline=True)

embed.add_field(name="📅 Send Date", value=f"{discord.utils.format_dt(message.created_at, 'F')}", inline=True)
if modal.children[0].value:
Expand Down

0 comments on commit 29ae3d2

Please sign in to comment.