-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
88 lines (70 loc) · 2.97 KB
/
index.js
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
const { Client, GatewayIntentBits } = require('discord.js');
const WOK = require("wokcommands"); // command handler
const path = require("path");
require("dotenv/config");
const { ymal } = require("./util/yaml-read")
const client = new Client({
intents: [
GatewayIntentBits.Guilds, // guild features
GatewayIntentBits.GuildMessages, // handling messages
GatewayIntentBits.MessageContent, // content of messages
GatewayIntentBits.GuildVoiceStates // voice state updates
]
});
const ymalConfig = ymal()
client.once('ready', async() => {
console.log(`Logged in as ${client.user.tag}!`);
new WOK({
// The client for your bot. This is the only required property
client,
// Path to your commands folder
commandsDir: path.join(__dirname, "commands"),
// Path to your features folder
featuresDir: path.join(__dirname, "features"),
// Configure your event handlers
events: {
// Where your events are located. This is required if you
// provide this events object
dir: path.join(__dirname, "events"),
// To learn how to properly configure your events please see
// https://docs.wornoffkeys.com/events/what-is-a-feature
},
// What server IDs are for testing. This is where test
// only commands are registered to
testServers: ymalConfig.SERVERS,
// Don't want some of the default commands? Add them here
disabledDefaultCommands: [
// DefaultCommands.ChannelCommand,
// DefaultCommands.CustomCommand,
// DefaultCommands.Prefix,
// DefaultCommands.RequiredPermissions,
// DefaultCommands.RequiredRoles,
// DefaultCommands.ToggleCommand
],
// Configure the cooldowns for your commands and features
cooldownConfig: {
errorMessage: "Please wait {TIME} before doing that again.",
botOwnersBypass: false,
// The amount of seconds required for a cooldown to be
// persistent via MongoDB.
dbRequired: 300,
},
// Dynamic validations
validations: {
// Syntax based validations: Ran per command whenever
// the bot starts up. Useful to throw errors if the
// syntax of a command is not correct.
syntax: path.join(__dirname, "validations", "syntax"),
// Runtime based validations: Ran per command whenever
// that command is ran. Should return true or false
// depending on if the command should be ran or not.
runtime: path.join(__dirname, "validations", "runtime"),
// For more information on how to configure dyanmic validations
// please see: TODO: add link
}
});
});
// Log in to Discord with your bot's token
client.login(ymalConfig.DISCORDBOTKEY).catch(err => {
console.error('Failed to log in check your token is valid:', err);
});