Skip to content

Commit dccbdcc

Browse files
authored
Merge pull request #19 from BenjammingKirby/master
Support 25 options and autocompletion for other djs sources
2 parents 19e7f3c + a325a33 commit dccbdcc

File tree

9 files changed

+454
-375
lines changed

9 files changed

+454
-375
lines changed

.eslintrc.json

Lines changed: 15 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -4,41 +4,26 @@
44
"es2021": true,
55
"node": true
66
},
7-
"extends": [
8-
"eslint:recommended",
9-
"plugin:@typescript-eslint/recommended"
10-
],
7+
"extends": ["eslint:recommended", "plugin:@typescript-eslint/recommended"],
118
"parser": "@typescript-eslint/parser",
129
"parserOptions": {
1310
"ecmaVersion": 12
1411
},
15-
"plugins": [
16-
"@typescript-eslint"
17-
],
12+
"plugins": ["@typescript-eslint"],
1813
"rules": {
19-
"indent": [
20-
"error",
21-
4, { "SwitchCase": 1 }
22-
],
23-
"linebreak-style": [
24-
"error",
25-
"unix"
26-
],
27-
"quotes": [
28-
"error",
29-
"double"
30-
],
31-
"semi": [
32-
"error",
33-
"always"
34-
],
35-
"strict" :"error",
36-
"no-var":"error",
37-
"no-console": ["warn", {"allow": ["info", "error", "warn"]}],
38-
"array-callback-return":"error",
39-
"yoda":"error",
40-
"@typescript-eslint/no-unused-vars": ["error", {"varsIgnorePattern": "^_", "argsIgnorePattern": "^_"}],
14+
"indent": ["off"],
15+
"@typescript-eslint/indent": ["error", 4, { "SwitchCase": 1 }],
16+
"linebreak-style": ["error", "unix"],
17+
"quotes": ["error", "double"],
18+
"semi": ["error", "always"],
19+
"strict": "error",
20+
"no-var": "error",
21+
"no-console": ["warn", { "allow": ["info", "error", "warn"] }],
22+
"array-callback-return": "error",
23+
"yoda": "error",
24+
"@typescript-eslint/no-unused-vars": ["error", { "varsIgnorePattern": "^_", "argsIgnorePattern": "^_" }],
4125
"@typescript-eslint/ban-ts-comment": "off",
42-
"@typescript-eslint/no-non-null-assertion": "off"
26+
"@typescript-eslint/no-non-null-assertion": "off",
27+
"prefer-const": ["error", { "destructuring": "all" }]
4328
}
4429
}

package-lock.json

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

src/bot.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { Client, Collection, LimitedCollection } from "discord.js";
33
import { MyContext } from "./interfaces";
44
import { loadCommands, interactionCreateHandler } from "./handlers/InteractionCreateHandler";
55
import { messageHandler } from "./handlers/MessageHandler";
6+
import { deleteButtonHandler } from "./utils/CommandUtils";
67

78
(async function () {
89
const context: MyContext = {
@@ -15,7 +16,7 @@ import { messageHandler } from "./handlers/MessageHandler";
1516
// For DMs, a partial channel object is received, in order to receive dms, CHANNEL partials must be activated
1617
partials: ["CHANNEL"],
1718
makeCache: (manager) => {
18-
//! Disabling these caches will break djs funcitonality
19+
//! Disabling these caches will break djs functionality
1920
const unsupportedCaches = [
2021
"GuildManager",
2122
"ChannelManager",
@@ -28,11 +29,18 @@ import { messageHandler } from "./handlers/MessageHandler";
2829
return new LimitedCollection({ maxSize: 0 });
2930
},
3031
}),
31-
commands: new Collection(),
32+
commands: {
33+
autocompletes: new Collection(),
34+
buttons: new Collection(),
35+
selectMenus: new Collection(),
36+
slashCommands: new Collection(),
37+
},
3238
cooldownCounter: new Collection(),
3339
};
3440
const docsBot = context.client;
3541
await loadCommands(context);
42+
// Add delete button handler
43+
context.commands.buttons.set("deletebtn", { custom_id: "deletebtn", run: deleteButtonHandler });
3644

3745
docsBot.on("error", console.error);
3846
docsBot.on("warn", console.warn);

0 commit comments

Comments
 (0)