This repository has been archived by the owner on Jul 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.ts
53 lines (47 loc) · 1.91 KB
/
main.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import * as Discord from 'discord.js';
import * as Commando from 'discord.js-commando';
import * as path from 'path';
import * as sqlite3 from 'sqlite3';
import * as sqlite from 'sqlite';
import { table } from 'table';
import * as figlet from 'figlet';
import * as package_json from './package.json';
let name = package_json.name;
var client: Commando.CommandoClient = new Commando.CommandoClient(
{
owner: config.owner,
commandPrefix: config.prefix,
nonCommandEditable: false
}
);
client.setProvider(
sqlite.open({
filename: path.join(__dirname, 'local/settings.sqlite3'),
driver: sqlite3.Database
}).then(db => new Commando.SQLiteProvider(db))
).catch(console.error);
client.on('ready', async () => {
await client.user.setActivity(config.activity.text, {type: config.activity.type}) // Setting the activity
.then(presence => console.log(`Activity set successfully: ${presence.activities[0].type} ${presence.activities[0].name}`)) // Log activity
.catch(console.error);
//console.log(`Bot-ts is ready.\nHelp: ${config.prefix}help\nAccount: ${client.user.tag}\nCopyright daniel11420 © 2020.\nSee license in LICENSE.`);
// Logging basic info
console.log(figlet.textSync(name));
console.log(package_json.description);
console.log(table([
['Account', client.user.tag],
['Activity', `${config.activity.type} ${config.activity.text}`],
['Help (Default)', `${config.prefix}help`],
[`${name} info`, `${name} version ${package_json.version}\n${package_json.license}\nCopyright ${package_json.author} (c) 2020`]
]));
});
client.registry
.registerDefaultTypes()
.registerGroups([
['teams', 'Penguin Games teams']
])
.registerDefaultGroups()
.registerDefaultCommands({help: true})
.registerCommandsIn(path.join(__dirname, 'commands'))
.unknownCommand = null;
client.login(config.token);