add delete button for message link embeds (#117)
Signed-off-by: IThundxr <contact@ithundxr.dev>
This commit is contained in:
parent
8a61d99323
commit
569a08c95d
7 changed files with 27 additions and 8 deletions
2
.env.example
Normal file
2
.env.example
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
DISCORD_TOKEN=
|
||||||
|
DISCORD_APP=
|
|
@ -1,3 +1,3 @@
|
||||||
# Refraction bot
|
# Refraction bot
|
||||||
|
|
||||||
Refraction Bot for [Discord](https://discord.gg/prismlauncher).
|
Refraction Bot for [Discord](https://discord.gg/prismlauncher).
|
||||||
|
|
|
@ -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"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
16
src/index.ts
16
src/index.ts
|
@ -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;
|
||||||
|
|
||||||
|
|
|
@ -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({
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue