feat(experimental): Testing slash command feature
This commit is contained in:
parent
68ff1429e1
commit
f4b479a9ca
2 changed files with 57 additions and 43 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "muffinbot",
|
"name": "muffinbot",
|
||||||
"version": "4.0.0-pudding.d240928c",
|
"version": "4.0.0-pudding.experimental_slash_test.1",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { ApplyOptions } from '@sapphire/decorators'
|
import { type ChatInputCommandInteraction, APIEmbed, Message } from 'discord.js'
|
||||||
import { Command, container } from '@sapphire/framework'
|
import { Command, container } from '@sapphire/framework'
|
||||||
import { Message } from 'discord.js'
|
import { ApplyOptions } from '@sapphire/decorators'
|
||||||
import { platform, arch } from 'os'
|
import { platform, arch } from 'os'
|
||||||
|
|
||||||
@ApplyOptions<Command.Options>({
|
@ApplyOptions<Command.Options>({
|
||||||
|
@ -11,10 +11,14 @@ import { platform, arch } from 'os'
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
class InformationCommand extends Command {
|
class InformationCommand extends Command {
|
||||||
public async messageRun(msg: Message) {
|
public registerApplicationCommands(registry: Command.Registry) {
|
||||||
await msg.reply({
|
registry.registerChatInputCommand(builder =>
|
||||||
embeds: [
|
builder.setName(this.name).setDescription(this.description),
|
||||||
{
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private async _embed(): Promise<APIEmbed> {
|
||||||
|
return {
|
||||||
title: `${this.container.client.user?.username}의 정ㅂ보`,
|
title: `${this.container.client.user?.username}의 정ㅂ보`,
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
|
@ -52,8 +56,18 @@ class InformationCommand extends Command {
|
||||||
thumbnail: {
|
thumbnail: {
|
||||||
url: this.container.client.user!.displayAvatarURL()!,
|
url: this.container.client.user!.displayAvatarURL()!,
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
],
|
}
|
||||||
|
|
||||||
|
public async messageRun(msg: Message) {
|
||||||
|
await msg.reply({
|
||||||
|
embeds: [await this._embed()],
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
public async chatInputRun(interaction: ChatInputCommandInteraction) {
|
||||||
|
await interaction.reply({
|
||||||
|
embeds: [await this._embed()],
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue