Skip to content

Commit

Permalink
Add reset command (#517)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazukazu123123 authored May 10, 2023
1 parent a539f15 commit b5c2cae
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions src/commands/reset.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { Command, type ChatInputCommand } from '@sapphire/framework'
import { guildCtxManager, workerClientMap } from '../index.js'
import { PermissionFlagsBits } from 'discord.js'

export class ResetCommand extends Command {
public constructor(
context: ChatInputCommand.Context,
options: ChatInputCommand.Options,
) {
super(context, {
...options,
description:
'このサーバーでの参加状態を初期化します。(⚠VCからBOTが退出します。)',
})
}

public override registerApplicationCommands(
registry: ChatInputCommand.Registry,
) {
registry.registerChatInputCommand((builder) =>
builder
.setName(this.name)
.setDescription(this.description)
.setDefaultMemberPermissions(PermissionFlagsBits.MoveMembers)
.setDMPermission(false),
)
}
public override async chatInputRun(
interaction: ChatInputCommand.Interaction,
) {
if (!interaction.inCachedGuild()) return
await guildCtxManager.get(interaction.guild).resetBots(workerClientMap)
return interaction.reply({
embeds: [
{
color: 0x00ff00,
title: `参加状態を初期化しました。`,
},
],
})
}
}

0 comments on commit b5c2cae

Please sign in to comment.