diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..a010304 --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +DISCORD_TOKEN= +DISCORD_APP= \ No newline at end of file diff --git a/README.md b/README.md index 4c66702..85a31f4 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # Refraction bot -Refraction Bot for [Discord](https://discord.gg/prismlauncher). \ No newline at end of file +Refraction Bot for [Discord](https://discord.gg/prismlauncher). diff --git a/renovate.json b/renovate.json index 738e5c5..e9cca0b 100644 --- a/renovate.json +++ b/renovate.json @@ -1,7 +1,4 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "config:base", - "config:js-app" - ] + "extends": ["config:base", "config:js-app"] } diff --git a/src/index.ts b/src/index.ts index 1c49c39..5a657e6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -98,6 +98,22 @@ client.once('ready', async () => { }); 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()) { const { commandName } = interaction; diff --git a/src/utils/resolveMessage.ts b/src/utils/resolveMessage.ts index 1e1d86a..e1ec162 100644 --- a/src/utils/resolveMessage.ts +++ b/src/utils/resolveMessage.ts @@ -79,7 +79,11 @@ export async function expandDiscordLink(message: Message): Promise { new ButtonBuilder() .setLabel('Jump to original message') .setStyle(ButtonStyle.Link) - .setURL(messageToShow.url) + .setURL(messageToShow.url), + new ButtonBuilder() + .setCustomId('delete-message') + .setLabel('Delete') + .setStyle(ButtonStyle.Danger) ); await message.reply({ diff --git a/tags/javaforgebugfix.md b/tags/javaforgebugfix.md index d48dd6a..6d13655 100644 --- a/tags/javaforgebugfix.md +++ b/tags/javaforgebugfix.md @@ -8,6 +8,6 @@ embed: 1. Click the instance that is broken, then select "Edit". 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. -4. You are good to go! +4. You are good to go! https://media.discordapp.net/attachments/1040383700845740072/1057840239751729172/Fix.png diff --git a/tags/vcredist.md b/tags/vcredist.md index 4d88a59..cfc2f40 100644 --- a/tags/vcredist.md +++ b/tags/vcredist.md @@ -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 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 \ No newline at end of file +See the [wiki page](https://prismlauncher.org/wiki/overview/frequent-issues/#%22msvcp140_2.dll-was-not-found%22) in the website for more information