Updated Client.ts

This commit is contained in:
Christer Warén 2021-08-19 01:50:35 +03:00
parent 76fe1aaae9
commit 9e6d60bde8

View File

@ -11,12 +11,10 @@ const GatewayIntents = new Discord.Intents();
GatewayIntents.add( GatewayIntents.add(
1 << 0, // GUILDS 1 << 0, // GUILDS
1 << 7, // GUILD_VOICE_STATES 1 << 7, // GUILD_VOICE_STATES
1 << 9 // GUILD_MESSAGES
); );
class RadioClient extends Client { class RadioClient extends Client {
readonly commands: Collection<string, command>; readonly commands: Collection<string, command>;
readonly commandAliases: Collection<string, command>;
readonly radio: Map<string, radio>; readonly radio: Map<string, radio>;
public funcs: any; public funcs: any;
readonly config = config; readonly config = config;
@ -27,7 +25,6 @@ class RadioClient extends Client {
intents: GatewayIntents intents: GatewayIntents
}); });
this.commands = new Collection(); this.commands = new Collection();
this.commandAliases = new Collection();
this.radio = new Map(); this.radio = new Map();
this.datastore = null; this.datastore = null;
@ -41,17 +38,15 @@ class RadioClient extends Client {
const commandFiles = fs.readdirSync(path.join("./src/client/commands")).filter(f => f.endsWith(".js")); const commandFiles = fs.readdirSync(path.join("./src/client/commands")).filter(f => f.endsWith(".js"));
for (const file of commandFiles) { for (const file of commandFiles) {
const command = require(`./client/commands/${file}`); const command = require(`./client/commands/${file}`);
command.uses = 0;
this.commands.set(command.name, command); this.commands.set(command.name, command);
this.commandAliases.set(command.alias, command);
} }
this.on("ready", () => { this.on("ready", () => {
require(`${events}ready`).execute(this, Discord); require(`${events}ready`).execute(this, Discord);
this.datastore = new Datastore(); this.datastore = new Datastore();
}); });
this.on("messageCreate", msg => { this.on("interactionCreate", interaction => {
require(`${events}msg`).execute(this, msg, Discord); require(`${events}interactionCreate`).execute(this, interaction, Discord);
}); });
this.on("voiceStateUpdate", (oldState, newState) => { this.on("voiceStateUpdate", (oldState, newState) => {
require(`${events}voiceStateUpdate`).execute(this, oldState, newState); require(`${events}voiceStateUpdate`).execute(this, oldState, newState);