diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 0000000..3bffcb3 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,35 @@ +--- +name: Bug report +about: Create a report to help us improve +title: 'bug: ' +labels: bug +assignees: '' + +--- + +**Describe the bug** +A clear and concise description of what the bug is. + +**To Reproduce** +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +**Expected behavior** +A clear and concise description of what you expected to happen. + +**Screenshots** +If applicable, add screenshots to help explain your problem. + +**Device Information (please complete the following information):** + - Device: [e.g. iPhone6] + - OS: [e.g. iOS8.1] + - Discord Version [e.g. 222111] + - Bunny Version [e.g e19e89c-main] + +**Checklists** +- [ ] I understand that this is a bug report and not a place to request new features or plugins +- [ ] I understand that this is no place to report bugs produced by a plugin +- [ ] I can reproduce this bug in Bunny's safe mode AND unable to reproduce it in vanilla/unmodded Discord diff --git a/package.json b/package.json index baf62d4..a363f9a 100644 --- a/package.json +++ b/package.json @@ -53,4 +53,4 @@ ] } } -} +} \ No newline at end of file diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ba9543e..90b6c5c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -3112,6 +3112,11 @@ packages: engines: {node: '>=12'} dev: true + /yargs-parser@21.1.1: + resolution: {integrity: sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==} + engines: {node: '>=12'} + dev: true + /yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} diff --git a/src/lib/api/commands/index.ts b/src/lib/api/commands/index.ts index 59768d5..46832d4 100644 --- a/src/lib/api/commands/index.ts +++ b/src/lib/api/commands/index.ts @@ -10,9 +10,10 @@ let commands: ApplicationCommand[] = []; */ export function patchCommands() { const unpatch = after("getBuiltInCommands", commandsModule, ([type], res: ApplicationCommand[]) => { - if (type === ApplicationCommandType.CHAT) { - return res.concat(commands.filter(c => c.__bunny?.shouldHide?.() !== false)); - } + return [...res, ...commands.filter(c => + (type instanceof Array ? type.includes(c.type) : type === c.type) + && c.__bunny?.shouldHide?.() !== false) + ]; }); // Register core commands @@ -30,13 +31,19 @@ export function patchCommands() { export function registerCommand(command: BunnyApplicationCommand): () => void { // Get built in commands - const builtInCommands = commandsModule.getBuiltInCommands(ApplicationCommandType.CHAT, true, false); + let builtInCommands: ApplicationCommand[]; + try { + builtInCommands = commandsModule.getBuiltInCommands(ApplicationCommandType.CHAT, true, false); + } catch { + builtInCommands = commandsModule.getBuiltInCommands(Object.values(ApplicationCommandType), true, false); + } + builtInCommands.sort((a: ApplicationCommand, b: ApplicationCommand) => parseInt(b.id!) - parseInt(a.id!)); const lastCommand = builtInCommands[builtInCommands.length - 1]; // Override the new command's id to the last command id - 1 - command.id = (parseInt(lastCommand.id, 10) - 1).toString(); + command.id = (parseInt(lastCommand.id!, 10) - 1).toString(); // Fill optional args command.__bunny = {