-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move client_id to env and try out release-it
- Loading branch information
Showing
10 changed files
with
2,367 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"npm": { | ||
"publish": false | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { | ||
ApplicationCommandOptionType, | ||
ChatInputCommandInteraction, | ||
Guild, | ||
RESTPostAPIChatInputApplicationCommandsJSONBody, | ||
} from 'discord.js'; | ||
import SuperClient from '../../../core/Client.js'; | ||
import BaseCommand from '../../../core/BaseCommand.js'; | ||
import { isDev } from '../../../utils/Utils.js'; | ||
import { emojis } from '../../../utils/Constants.js'; | ||
import { RemoveMethods } from '../../../typings/index.js'; | ||
|
||
export default class Respawn extends BaseCommand { | ||
readonly staffOnly = true; | ||
readonly data: RESTPostAPIChatInputApplicationCommandsJSONBody = { | ||
name: 'leave', | ||
description: 'Make me leave a server (Dev\'s toy only)', | ||
options: [ | ||
{ | ||
type: ApplicationCommandOptionType.String, | ||
name: 'server_id', | ||
description: 'The ID of the server to leave.', | ||
required: true, | ||
}, | ||
], | ||
}; | ||
async execute(interaction: ChatInputCommandInteraction) { | ||
if (!isDev(interaction.user.id)) { | ||
await interaction.reply({ | ||
content: `${emojis.dnd_anim} You are not authorized to use this command.`, | ||
ephemeral: true, | ||
}); | ||
return; | ||
} | ||
|
||
const guildId = interaction.options.getString('server_id', true); | ||
const leftGuild = SuperClient.resolveEval( | ||
await interaction.client.cluster.broadcastEval( | ||
async (client, _serverId) => { | ||
const guild = client.guilds.cache.get(_serverId); | ||
if (!guild) return; | ||
|
||
return await guild.leave(); | ||
}, | ||
{ guildId, context: guildId }, | ||
), | ||
) as RemoveMethods<Guild> | undefined; | ||
|
||
await interaction.reply( | ||
`${emojis.tick} Successfully Left guild ${leftGuild?.name} (${leftGuild?.id})`, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.