Skip to content

Commit

Permalink
make the buttons persistent
Browse files Browse the repository at this point in the history
  • Loading branch information
Ast3risk-ops committed Dec 28, 2024
1 parent 652a911 commit d64eda6
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 18 deletions.
12 changes: 7 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
async def on_ready():
activity = discord.CustomActivity(name="🗃️ Archiving your messages")
await bot.change_presence(status=discord.Status.online, activity=activity)
bot.add_view(DeleteBookmark())
bot.ready(
style=ezcord.ReadyEvent.default,
)
Expand Down Expand Up @@ -48,24 +49,26 @@ async def callback(self, interaction: discord.Interaction):
await interaction.response.edit_message(embed=embed)
return
class DeleteBookmark(discord.ui.View):
@discord.ui.button(label="", style=discord.ButtonStyle.secondary, emoji="🗑️")
def __init__(self):
super().__init__(timeout=None)
@discord.ui.button(label="", custom_id="delete", style=discord.ButtonStyle.secondary, emoji="🗑️")
async def button_callback(self, button, interaction):
self.disable_all_items()
await interaction.message.delete()
return
@discord.ui.button(label="", style=discord.ButtonStyle.secondary, emoji="📌")
@discord.ui.button(label="", custom_id="pin", style=discord.ButtonStyle.secondary, emoji="📌")
async def pin_callback(self, button, interaction):
await interaction.message.pin()
return
@discord.ui.button(label="", style=discord.ButtonStyle.secondary, emoji="⬇️")
@discord.ui.button(label="", custom_id="move_to_bottom", style=discord.ButtonStyle.secondary, emoji="⬇️")
async def button2_callback(self, button, interaction):
for i in interaction.message.embeds:
i.set_footer(text="ℹ️ Go back to the original message to view attachments and embeds.")
await interaction.message.reply(embed=i, view=DeleteBookmark())
for i in interaction.message.attachments:
await interaction.message.reply(i)
return
@discord.ui.button(label="", style=discord.ButtonStyle.secondary, emoji="🎨")
@discord.ui.button(label="", custom_id="customize", style=discord.ButtonStyle.secondary, emoji="🎨")
async def customizer(self, button, interaction):
await interaction.response.send_modal(ColourModal())
return
Expand All @@ -77,7 +80,6 @@ def __init__(self):
self.add_item(SiteButton)
CodeButton = discord.ui.Button(label='Source Code', style=discord.ButtonStyle.url, url='https://github.com/Ast3risk-ops/archiver')
self.add_item(CodeButton)

@bot.slash_command(
# This command can be used by guild members, but also by users anywhere if they install it
integration_types={
Expand Down
11 changes: 7 additions & 4 deletions main_emoji.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
async def on_ready():
activity = discord.CustomActivity(name="🗃️ Archiving your messages")
await bot.change_presence(status=discord.Status.online, activity=activity)
bot.add_view(DeleteBookmark())
bot.ready(
style=ezcord.ReadyEvent.default,
)
Expand Down Expand Up @@ -49,24 +50,26 @@ async def callback(self, interaction: discord.Interaction):
await interaction.response.edit_message(embed=embed)
return
class DeleteBookmark(discord.ui.View):
@discord.ui.button(label="", style=discord.ButtonStyle.secondary, emoji="🗑️")
def __init__(self):
super().__init__(timeout=None)
@discord.ui.button(label="", custom_id="delete", style=discord.ButtonStyle.secondary, emoji="🗑️")
async def button_callback(self, button, interaction):
self.disable_all_items()
await interaction.message.delete()
return
@discord.ui.button(label="", style=discord.ButtonStyle.secondary, emoji="📌")
@discord.ui.button(label="", custom_id="pin", style=discord.ButtonStyle.secondary, emoji="📌")
async def pin_callback(self, button, interaction):
await interaction.message.pin()
return
@discord.ui.button(label="", style=discord.ButtonStyle.secondary, emoji="⬇️")
@discord.ui.button(label="", custom_id="move_to_bottom", style=discord.ButtonStyle.secondary, emoji="⬇️")
async def button2_callback(self, button, interaction):
for i in interaction.message.embeds:
i.set_footer(text="ℹ️ Go back to the original message to view attachments and embeds.")
await interaction.message.reply(embed=i, view=DeleteBookmark())
for i in interaction.message.attachments:
await interaction.message.reply(i)
return
@discord.ui.button(label="", style=discord.ButtonStyle.secondary, emoji="🎨")
@discord.ui.button(label="", custom_id="customize", style=discord.ButtonStyle.secondary, emoji="🎨")
async def customizer(self, button, interaction):
await interaction.response.send_modal(ColourModal())
return
Expand Down
Binary file modified www/bun.lockb
Binary file not shown.
18 changes: 9 additions & 9 deletions www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"postinstall": "nuxt prepare"
},
"dependencies": {
"@divriots/jampack": "0.32.0",
"@iconify-json/radix-icons": "1.2.2",
"@iconify-json/ri": "1.2.5",
"@iconify-json/simple-icons": "1.2.17",
"nuxt": "3.14.1592",
"shadcn-docs-nuxt": "0.8.7",
"sharp": "0.33.5",
"vue": "3.5.13",
"vue-router": "4.5.0"
"@divriots/jampack": "^0.32.0",
"@iconify-json/radix-icons": "^1.2.2",
"@iconify-json/ri": "^1.2.5",
"@iconify-json/simple-icons": "^1.2.17",
"nuxt": "^3.15.0",
"shadcn-docs-nuxt": "^0.8.7",
"sharp": "^0.33.5",
"vue": "^3.5.13",
"vue-router": "^4.5.0"
}
}

0 comments on commit d64eda6

Please sign in to comment.