Skip to content

Commit e08ea1e

Browse files
committed
Fix middleware bug in DMs, fix other compiler errors, update tasks.json
1 parent 7031976 commit e08ea1e

File tree

8 files changed

+20
-16
lines changed

8 files changed

+20
-16
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ config.json
55
npm-debug*
66
/test/storage
77
/test/**/*.d.ts
8-
/test/**/*.js
8+
/test/**/*.js*
99
test_*.js
1010
/scripts/**/*.js
1111
/scripts/**/*.d.ts

.vscode/tasks.json

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,25 @@
22
// See https://go.microsoft.com/fwlink/?LinkId=733558
33
// for the documentation about the tasks.json format
44
"version": "2.0.0",
5-
"command": "gulp",
5+
"command": "npx",
66
"type": "shell",
77
"tasks": [
88
{
99
"label": "build:vscode",
10-
"args": [],
10+
"args": ["gulp", "build"],
1111
"group": "build",
1212
"isBackground": false,
1313
"problemMatcher": ["$tsc"]
1414
},
1515
{
1616
"label": "tests",
17-
"args": ["tests"],
18-
"command": "gulp",
17+
"args": ["gulp", "tests"],
1918
"type": "shell",
2019
"problemMatcher": ["$tsc"]
2120
},
2221
{
2322
"label": "docs",
24-
"args": ["docs"],
25-
"command": "gulp",
23+
"args": ["gulp", "docs"],
2624
"type": "shell"
2725
}
2826
]

src/command/CommandDecorators.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function using(func: MiddlewareFunction): MethodDecorator
4343
// Send the middleware result to the channel, utilizing compact mode if enabled
4444
const sendMiddlewareResult: (result: string, options?: MessageOptions) => Promise<any> =
4545
async (result, options) => {
46-
if (await message.guild.storage!.settings.get('compact') || this.client.compact)
46+
if (await message.guild?.storage?.settings.get('compact') || this.client.compact)
4747
{
4848
if (message.reactions.size > 0) await message.reactions.removeAll();
4949
return CompactModeHelper.registerButton(

src/command/CommandDispatcher.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export class CommandDispatcher
155155
// Function to send middleware result, utilizing compact mode if enabled
156156
const sendMiddlewareResult: (result: string, options?: MessageOptions) => Promise<any> =
157157
async (result, options) => {
158-
if (await message.guild.storage!.settings.get('compact') || this._client.compact)
158+
if (await message.guild?.storage?.settings.get('compact') || this._client.compact)
159159
{
160160
if (message.reactions.size > 0) await message.reactions.removeAll();
161161
return CompactModeHelper.registerButton(

src/command/CommandRegistry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export class CommandRegistry<
3232
}
3333

3434
public static get [Symbol.species]() {
35-
return Collection;
35+
return Collection as any;
3636
}
3737

3838
/**

src/command/base/Shortcuts.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Of course the eval command is owner-only, but this should give you an idea of ho
8989

9090
await message.guild.storage!.settings.set(`shortcuts.${name}`, content);
9191

92-
content = Util.escapeMarkdown(content, true);
92+
content = Util.escapeMarkdown(content, { codeBlock: true, codeBlockContent: true });
9393
return this.respond(message, res.CMD_SHORTCUTS_SET_SUCCESS({ name, content }));
9494
}
9595

@@ -102,7 +102,7 @@ Of course the eval command is owner-only, but this should give you an idea of ho
102102
if (!shortcuts[name])
103103
return this.respond(message, res.CMD_SHORTCUTS_ERR_MISSING({ name }));
104104

105-
const content: string = Util.escapeMarkdown(shortcuts[name], true);
105+
const content: string = Util.escapeMarkdown(shortcuts[name], { codeBlock: true, codeBlockContent: true });
106106
return this.respond(message, res.CMD_SHORTCUTS_GET_CONTENT({ name, content }));
107107
}
108108

src/storage/SequelizeProvider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function SequelizeProvider(url: string, dialect: Dialect, debug: boolean)
5151
key: { type: dataTypes.STRING, allowNull: false, primaryKey: true },
5252
value: [Dialect.Postgres, Dialect.SQLite, Dialect.MSSQL].includes(dialect)
5353
? dataTypes.TEXT
54-
: dataTypes.TEXT('long')
54+
: dataTypes.TEXT({ length: 'long' })
5555
},
5656
{
5757
modelName: name,

test/commands/test_command.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,13 @@ export class TestCommandTwo extends TestCommandClass
3535
desc: 'test command 2',
3636
usage: '<prefix>test2 <test> <foo>',
3737
});
38+
39+
this.use((message, args) => "bbbbbbb");
3840
}
3941

40-
public action() {}
42+
public action() {
43+
console.log('aaaaa');
44+
}
4145
}
4246

4347
// @ownerOnly
@@ -55,14 +59,16 @@ export default class extends TestCommandClass
5559
aliases: ['testing', 'testo'],
5660
desc: 'test command',
5761
usage: '<prefix>test <test> <foo>',
58-
guildOnly: true,
62+
// guildOnly: true,
5963
argOpts: {
6064
separator: ''
6165
}
6266
// ratelimit: '2/10s'
6367
});
6468

65-
this.lock = new CommandLock('help', 'ping');
69+
this.use((message, args) => [message, args]);
70+
71+
// this.lock = new CommandLock('help', 'ping');
6672

6773
// this.use(resolve('foo: BannedUser'));
6874
// this.use(expect('foo: BannedUser'));

0 commit comments

Comments
 (0)