/[sudobot]/trunk/src/cli-commands/db/SyncDBCommand.ts
ViewVC logotype

Annotation of /trunk/src/cli-commands/db/SyncDBCommand.ts

Parent Directory Parent Directory | Revision Log Revision Log


Revision 329 - (hide annotations)
Mon Jul 29 17:29:34 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: application/typescript
File size: 861 byte(s)
refactor(cli): remove bannedguild model
1 rakin 86 import { readdir } from "fs/promises";
2     import path from "path";
3     import { exit } from "process";
4     import readline from "readline";
5     import DiscordClient from "../../client/Client";
6     import BaseCLICommand from "../../utils/structures/BaseCLICommand";
7    
8     export default class SyncDBCommand extends BaseCLICommand {
9     constructor() {
10     super('syncdb', 'guild');
11     }
12    
13     async run(client: DiscordClient, argv: string[], args: string[]) {
14 rakin 104 const files = await readdir(path.join(__dirname, '/../../models'));
15 rakin 86
16     for await (const file of files) {
17     if (file === '..' || file === '.')
18     continue;
19    
20 rakin 104 const { default: model } = await import(path.join(__dirname, '/../../models', file));
21 rakin 86 await model.sync({
22     logging: console.log
23     });
24     }
25    
26     exit(0);
27     }
28     }

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26