feat: Thoroughly type ContextCommand

This commit is contained in:
Linnea Gräf 2025-04-09 18:55:03 +02:00
parent f83a6dd1a3
commit c1670b8abd
No known key found for this signature in database
GPG key ID: AA563E93EB628D91
3 changed files with 20 additions and 8 deletions

View file

@ -1,13 +1,14 @@
import { ApplicationCommandType, ContextMenuCommandBuilder, ContextMenuCommandInteraction, InteractionContextType, Snowflake } from "discord.js";
import { ApplicationCommandType, ContextMenuCommandBuilder, ContextMenuCommandInteraction, InteractionContextType, Snowflake, User } from "discord.js";
import { ContextCommand } from "../command.ts";
export default class RailUser extends ContextCommand {
export default class RailUser extends ContextCommand<User> {
targetType: ApplicationCommandType.User = ApplicationCommandType.User;
contextDefinition: ContextMenuCommandBuilder =
new ContextMenuCommandBuilder()
.setName('rail')
.setType(ApplicationCommandType.User)
async run(interaction: ContextMenuCommandInteraction, target: Snowflake): Promise<void> {
await interaction.reply(`Raililng <@${target}>.`)
async run(interaction: ContextMenuCommandInteraction, target: User): Promise<void> {
await interaction.reply(`Raililng <@${target.id}>.`)
await new Promise(resolve => setTimeout(resolve, 1000))
await interaction.editReply(`UHGhghgghghgh. Railing successfull.`)
}