Skip to content
Extraits de code Groupes Projets
Valider df126c75 rédigé par Will Hunt's avatar Will Hunt
Parcourir les fichiers

fix tests

parent 51dfa6cc
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -44,7 +44,7 @@ export class DiscordClientFactory {
messageCacheLifetime: 5,
ws: {
intents: this.config.usePriviledgedIntents ? Intents.PRIVILEGED : Intents.NON_PRIVILEGED,
}
},
});
const waitPromise = new Promise((resolve, reject) => {
......@@ -70,7 +70,7 @@ export class DiscordClientFactory {
messageCacheLifetime: 5,
ws: {
intents: Intents.NON_PRIVILEGED,
}
},
});
await client.login(token, false);
......@@ -103,7 +103,7 @@ export class DiscordClientFactory {
messageCacheLifetime: 5,
ws: {
intents: Intents.NON_PRIVILEGED,
}
},
});
const jsLog = new Log("discord.js-ppt");
......
......@@ -15,20 +15,18 @@ limitations under the License.
*/
import * as BetterSQLite3 from "better-sqlite3";
import { Database } from "better-sqlite3";
import { Log } from "../log";
import { IDatabaseConnector, ISqlCommandParameters, ISqlRow } from "./connector";
const log = new Log("SQLite3");
export class SQLite3 implements IDatabaseConnector {
private db: Database;
private db: BetterSQLite3.Database;
constructor(private filename: string) {
}
public async Open() {
log.info(`Opening ${this.filename}`);
this.db = new BetterSQLite3(this.filename);
}
......@@ -44,7 +42,7 @@ export class SQLite3 implements IDatabaseConnector {
public async Run(sql: string, parameters?: ISqlCommandParameters): Promise<void> {
log.silly("Run:", sql);
await this.db.prepare(sql).run(parameters || []);
this.db.prepare(sql).run(parameters || []);
}
public async Close(): Promise<void> {
......@@ -53,6 +51,6 @@ export class SQLite3 implements IDatabaseConnector {
public async Exec(sql: string): Promise<void> {
log.silly("Exec:", sql);
await this.db.exec(sql);
this.db.exec(sql);
}
}
......@@ -55,6 +55,14 @@ export class MockDiscordClient {
this.testCallbacks.set(event, callback);
}
public once(event: string, callback: (...data: any[]) => void) {
this.testCallbacks.set(event, () => {
this.testCallbacks.delete(event);
callback();
});
}
public async emit(event: string, ...data: any[]) {
return await this.testCallbacks.get(event)!.apply(this, data);
}
......@@ -67,6 +75,9 @@ export class MockDiscordClient {
if (this.testCallbacks.has("ready")) {
this.testCallbacks.get("ready")!();
}
if (this.testCallbacks.has("shardReady")) {
this.testCallbacks.get("shardReady")!();
}
return;
}
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment