add delete button for message link embeds (#117)

Signed-off-by: IThundxr <contact@ithundxr.dev>
This commit is contained in:
IThundxr 2023-03-09 20:33:14 -05:00 committed by GitHub
parent 8a61d99323
commit 569a08c95d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 27 additions and 8 deletions

2
.env.example Normal file
View file

@ -0,0 +1,2 @@
DISCORD_TOKEN=
DISCORD_APP=

View file

@ -1,3 +1,3 @@
# Refraction bot # Refraction bot
Refraction Bot for [Discord](https://discord.gg/prismlauncher). Refraction Bot for [Discord](https://discord.gg/prismlauncher).

View file

@ -1,7 +1,4 @@
{ {
"$schema": "https://docs.renovatebot.com/renovate-schema.json", "$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [ "extends": ["config:base", "config:js-app"]
"config:base",
"config:js-app"
]
} }

View file

@ -98,6 +98,22 @@ client.once('ready', async () => {
}); });
client.on('interactionCreate', async (interaction) => { client.on('interactionCreate', async (interaction) => {
if (interaction.isButton() && interaction.customId === 'delete-message') {
const messageRef = interaction.message.reference?.messageId;
if (messageRef) {
const msg = await interaction.message.channel.messages.fetch(messageRef);
if (interaction?.user === msg.author) {
await interaction.message.delete();
} else {
await interaction.reply({
content: 'You can only delete your own messages!',
ephemeral: true,
});
}
}
}
if (interaction.isChatInputCommand()) { if (interaction.isChatInputCommand()) {
const { commandName } = interaction; const { commandName } = interaction;

View file

@ -79,7 +79,11 @@ export async function expandDiscordLink(message: Message): Promise<void> {
new ButtonBuilder() new ButtonBuilder()
.setLabel('Jump to original message') .setLabel('Jump to original message')
.setStyle(ButtonStyle.Link) .setStyle(ButtonStyle.Link)
.setURL(messageToShow.url) .setURL(messageToShow.url),
new ButtonBuilder()
.setCustomId('delete-message')
.setLabel('Delete')
.setStyle(ButtonStyle.Danger)
); );
await message.reply({ await message.reply({

View file

@ -8,6 +8,6 @@ embed:
1. Click the instance that is broken, then select "Edit". 1. Click the instance that is broken, then select "Edit".
2. Choose version and then click Forge, then click the change version button. 2. Choose version and then click Forge, then click the change version button.
3. You can then change the version, choose the latest, and click OK. 3. You can then change the version, choose the latest, and click OK.
4. You are good to go! <a:minecraftpartyparrotr:1032312401577652274> 4. You are good to go! <a:minecraftpartyparrotr:1032312401577652274>
https://media.discordapp.net/attachments/1040383700845740072/1057840239751729172/Fix.png https://media.discordapp.net/attachments/1040383700845740072/1057840239751729172/Fix.png

View file

@ -13,4 +13,4 @@ You need:
- [vcredist 2022 x86](https://aka.ms/vs/17/release/vc_redist.x86.exe) if you're using PrismLauncher-Windows-MSVC-Legacy (the reccomended version for Windows 7/8.1 and Windows 10 32 bit) - [vcredist 2022 x86](https://aka.ms/vs/17/release/vc_redist.x86.exe) if you're using PrismLauncher-Windows-MSVC-Legacy (the reccomended version for Windows 7/8.1 and Windows 10 32 bit)
- [vcredist 2022 arm64](https://aka.ms/vs/17/release/vc_redist.arm64.exe) if you're using PrismLauncher-Windows-MSVC-arm64 (the reccomended version for Windows 10/11 on ARM) - [vcredist 2022 arm64](https://aka.ms/vs/17/release/vc_redist.arm64.exe) if you're using PrismLauncher-Windows-MSVC-arm64 (the reccomended version for Windows 10/11 on ARM)
See the [wiki page](https://prismlauncher.org/wiki/overview/frequent-issues/#%22msvcp140_2.dll-was-not-found%22) in the website for more information See the [wiki page](https://prismlauncher.org/wiki/overview/frequent-issues/#%22msvcp140_2.dll-was-not-found%22) in the website for more information