eximiabots-radiox/src/Client.ts

62 lines
1.9 KiB
TypeScript
Raw Normal View History

2022-07-18 20:44:19 +00:00
import { Client, Collection, IntentsBitField } from "discord.js";
2023-06-04 01:07:41 +00:00
import Datastore from "./client/classes/Datastore";
import Radio from "./client/classes/Radio";
import Stations from "./client/classes/Stations";
import Streamer from "./client/classes/Streamer";
2023-06-04 01:29:42 +00:00
import Statistics from "./client/classes/Statistics";
2023-06-04 21:13:15 +00:00
import { command } from "./client/commands";
2023-06-04 01:07:41 +00:00
import config from "./config";
2023-06-06 00:41:04 +00:00
import events from "./client/events"
2023-06-05 22:39:35 +00:00
import { funcs } from "./client/funcs";
2023-06-05 23:27:46 +00:00
import { messages } from "./client/messages";
2021-09-02 15:18:37 +00:00
2022-07-18 20:44:19 +00:00
const GatewayIntents = new IntentsBitField();
2021-06-08 09:01:56 +00:00
GatewayIntents.add(
1 << 0, // GUILDS
1 << 7, // GUILD_VOICE_STATES
1 << 9 // GUILD_MESSAGES
2021-06-08 09:01:56 +00:00
);
2023-06-04 02:48:42 +00:00
export default class RadioClient extends Client {
2021-06-08 09:01:56 +00:00
readonly commands: Collection<string, command>;
2023-06-05 22:39:35 +00:00
readonly funcs = funcs;
2021-06-08 09:01:56 +00:00
readonly config = config;
readonly messages = messages;
public datastore: Datastore | null;
2021-09-16 01:51:36 +00:00
public stations: Stations | null;
2021-09-11 14:11:10 +00:00
public streamer: Streamer | null;
2021-09-16 01:51:36 +00:00
public statistics: Statistics | null;
public radio: Radio | null;
2023-06-04 19:35:07 +00:00
2021-06-08 09:01:56 +00:00
constructor() {
super({
intents: GatewayIntents
});
this.commands = new Collection();
this.datastore = null;
2021-09-16 01:51:36 +00:00
this.stations = null;
2021-09-11 14:11:10 +00:00
this.streamer = null;
2021-09-16 01:51:36 +00:00
this.statistics = null;
this.radio = null;
2021-06-08 09:01:56 +00:00
2021-09-02 13:50:01 +00:00
console.log('RadioX ' + this.config.version);
console.log('Internet Radio to your Discord guild');
2023-12-31 23:54:22 +00:00
console.log('(c)2020-2024 EximiaBots by Warén Group');
2021-09-02 13:50:01 +00:00
console.log('');
this.funcs.logger("Bot", "Starting");
2021-09-09 15:55:42 +00:00
this.funcs.logger("Maintenance Mode", "Enabled");
this.config.maintenanceMode = true;
2021-09-09 15:55:42 +00:00
2023-06-06 00:41:04 +00:00
events(this);
2021-06-08 09:01:56 +00:00
2021-09-09 22:54:43 +00:00
this.login(this.config.token).catch((err) => {
2023-06-05 22:39:35 +00:00
this.funcs.logger("Discord Client", "Login Error");
2021-09-09 22:54:43 +00:00
console.log(err);
console.log('');
});
2021-06-08 09:01:56 +00:00
}
}