Converted main codebase to typescript
Signed-off-by: Taken <taken@mairimashita.org>
This commit is contained in:
36
src/commands-contextmenu/congratsmessage.ts
Normal file
36
src/commands-contextmenu/congratsmessage.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
import { ContextMenuCommandBuilder, ApplicationCommandType, PermissionFlagsBits, userMention } from "discord.js"
|
||||
import { ContextMenu } from "../interfaces"
|
||||
|
||||
export = {
|
||||
name: "congratsmessage",
|
||||
description: "Congratulate a user.",
|
||||
type: "contextmenu",
|
||||
dev: false,
|
||||
|
||||
data: new ContextMenuCommandBuilder()
|
||||
.setName("Congratulate")
|
||||
.setType(ApplicationCommandType.Message)
|
||||
.setDefaultMemberPermissions(PermissionFlagsBits.ManageMessages),
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
const { targetId } = interaction
|
||||
const message = await interaction.channel!.messages.fetch(targetId)
|
||||
|
||||
if (!message) {
|
||||
return interaction.reply({ content: "That user does not exist.", ephemeral: true })
|
||||
}
|
||||
|
||||
const target = message.author
|
||||
|
||||
await message.reply({
|
||||
embeds: [{
|
||||
title: "Congratulations!",
|
||||
description: `GG to ${userMention(target.id)}!`,
|
||||
}]
|
||||
})
|
||||
await message.react("🎉")
|
||||
|
||||
await interaction.reply({ content: "Sent a congrats message", ephemeral: true })
|
||||
}
|
||||
} as ContextMenu
|
||||
Reference in New Issue
Block a user