Skip to content

Commit

Permalink
feat(help): user install試験的
Browse files Browse the repository at this point in the history
  • Loading branch information
gx1285 authored Aug 22, 2024
1 parent 22adc8b commit 0e93b77
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/command/chatinput/help.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ import {
EmbedBuilder,
SlashCommandBuilder,
} from 'discord.js';
import { ApplicationIntegrationType, InteractionContextType } from '../../utils/extrans.js';
export default {
command: new SlashCommandBuilder()
.setName('help')
.setDescription('helpを表示します。(コマンド名が指定されている場合はそのコマンドの情報を表示します。)')
.addStringOption((input) =>
input.setName('name').setDescription('コマンド名').setAutocomplete(true).setRequired(false),
),
).setContexts([InteractionContextType.BotDM,InteractionContextType.Guild])
.setIntegrationTypes([ApplicationIntegrationType.UserInstall,ApplicationIntegrationType.GuildInstall]),
ownersOnly: false,
modOnly: false,
permissions: false,
Expand Down
21 changes: 21 additions & 0 deletions src/utils/extrans.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,27 @@ declare module 'discord.js' {
function setGuildOnly() {
return this.setDMPermission(false);
}
function setContexts(...contexts: InteractionContextType[]){
Reflect.set(this, "contexts", contexts);
return this;
}
function setIntegrationTypes(...integrationTypes:ApplicationIntegrationType[]) {
Reflect.set(this, 'integration_types', integrationTypes);
return this;
}
export enum ApplicationIntegrationType {
GuildInstall = 0,
UserInstall = 1,
}
export enum InteractionContextType {
Guild = 0,
BotDM = 1,
PrivateChannel = 2,
}

SlashCommandBuilder.prototype.setGuildOnly = setGuildOnly;
ContextMenuCommandBuilder.prototype.setGuildOnly = setGuildOnly;
SlashCommandBuilder.prototype.setContexts = setContexts;
ContextMenuCommandBuilder.prototype.setContexts = setContexts;
SlashCommandBuilder.prototype.setIntegrationTypes = setIntegrationTypes;
ContextMenuCommandBuilder.prototype.setIntegrationTypes = setIntegrationTypes;

0 comments on commit 0e93b77

Please sign in to comment.