Skip to content

Commit 8d877d8

Browse files
committed
Allow using all commands everywhere
1 parent c3e6346 commit 8d877d8

File tree

4 files changed

+40
-33
lines changed

4 files changed

+40
-33
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,9 @@ English and Hungarian translations have been included, so no translators will be
4848
- 🇮🇹 Italian: [RVG|𝓵𝓸𝓻𝔂](https://top.gg/bot/1076200668810985634)
4949
- 🇰🇷 Korean
5050
- [Bin](https://crowdin.com/profile/cheesepickle12345678)
51+
- [SkyStorage_](https://crowdin.com/profile/SkyStorage_)
5152
- [김카츄 (sjk)](https://github.com/sjkim04)
53+
- [미르냥](https://crowdin.com/profile/Mirnyang)
5254
- 🇳🇴 Norwegian: [Phillip Rodseth](https://crowdin.com/profile/philliphatrod)
5355
- 🇵🇱 Polish: [MinerPL](https://crowdin.com/profile/MinerPL)
5456
- 🇧🇷 Portuguese, Brazilian: [leo0six](https://crowdin.com/profile/leo0six)

package-lock.json

Lines changed: 25 additions & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@
2525
"axios": "^1.6.8",
2626
"bufferutil": "^4.0.3",
2727
"concurrently": "^8.2.0",
28-
"discord-api-types": "^0.37.101",
29-
"discord.js": "^14.16.2",
28+
"discord-api-types": "^0.37.104",
29+
"discord.js": "^14.16.3",
3030
"dotenv": "^16.3.1",
3131
"i18next": "^23.4.4",
3232
"i18next-fs-backend": "^2.1.5",
Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
11
import { TFunction } from 'i18next';
22
import {
3+
ApplicationIntegrationType,
4+
InteractionContextType,
35
RESTPostAPIApplicationCommandsJSONBody as ApplicationCommand,
46
RESTPostAPIApplicationGuildCommandsJSONBody as ApplicationGuildCommand,
57
type RESTPostAPIChatInputApplicationCommandsJSONBody,
6-
} from 'discord-api-types/v10.js';
8+
} from 'discord-api-types/v10';
79
import { chatInputCommandMap, chatInputCommandNames } from './commands.js';
810
import { messageContextMenuCommandMap, messageContextMenuCommands } from './message-context-menu-commands.js';
911

10-
const commonChatInputCommandOptions: Partial<RESTPostAPIChatInputApplicationCommandsJSONBody> = {
11-
dm_permission: true,
12-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- Missing beta keys from types
13-
// @ts-ignore
14-
integration_types: [0, 1],
15-
contexts: [0, 1, 2],
12+
const commonCommandOptions: Pick<RESTPostAPIChatInputApplicationCommandsJSONBody, 'integration_types' | 'contexts'> = {
13+
integration_types: [ApplicationIntegrationType.UserInstall, ApplicationIntegrationType.GuildInstall],
14+
contexts: [InteractionContextType.Guild, InteractionContextType.BotDM, InteractionContextType.PrivateChannel],
1615
};
1716

1817
export const getApplicationCommands = (t: TFunction): (ApplicationGuildCommand & ApplicationCommand)[] => [
1918
...chatInputCommandNames.map((commandName) => ({
20-
...commonChatInputCommandOptions,
19+
...commonCommandOptions,
2120
...chatInputCommandMap[commandName].getDefinition(t),
2221
})),
23-
...messageContextMenuCommands.map((commandName) => messageContextMenuCommandMap[commandName].getDefinition(t)),
22+
...messageContextMenuCommands.map((commandName) => ({
23+
...messageContextMenuCommandMap[commandName].getDefinition(t),
24+
...commonCommandOptions,
25+
})),
2426
];

0 commit comments

Comments
 (0)