feat: Thoroughly type ContextCommand
This commit is contained in:
parent
f83a6dd1a3
commit
c1670b8abd
3 changed files with 20 additions and 8 deletions
|
|
@ -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.`)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue