Untitled
unknown
plain_text
a year ago
2.2 kB
5
Indexable
const { Client, Collection, GatewayIntentBits, Partials } = require("discord.js");
const { ClusterClient, getInfo } = require("discord-hybrid-sharding");
const { Rainlink, Library } = require("rainlink");
const { ApplePlugin } = require("rainlink-apple");
const { DeezerPlugin } = require("rainlink-deezer");
const { SpotifyPlugin } = require("rainlink-spotify");
const { VoicePlugin } = require("rainlink-voice");
class MainClient extends Client {
constructor() {
super({
shards: getInfo().SHARD_LIST,
shardCount: getInfo().TOTAL_SHARDS,
failIfNotExists: true,
allowedMentions: {
parse: ["roles", "users", "everyone"],
repliedUser: false,
},
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildVoiceStates,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
],
partials: [Partials.Message, Partials.Channel, Partials.Reaction],
});
this.config = require("../settings/config.js");
this.emoji = require("../settings/emoji.js");
this.guildData = require("../schemas/guild.js");
this.userData = require("../schemas/user.js");
this.embedColor = this.config.embedColor;
this.owner = this.config.owner;
this.slash = new Collection();
this.manager = new Rainlink({
options: this.config.rainlinkOptions,
library: new Library.DiscordJS(this),
nodes: this.config.nodes,
plugins: [
new ApplePlugin({
countryCode: "us",
imageWidth: 600,
imageHeight: 900,
}),
new SpotifyPlugin({
clientId: this.config.spotifyDetails.clientId,
clientSecret: this.config.spotifyDetails.clientSecret,
playlistPageLimit: 1,
albumPageLimit: 1,
searchLimit: 20,
searchMarket: "US",
}),
new DeezerPlugin(),
new VoicePlugin(),
],
});
if (!this.token) this.token = this.config.token;
["antiCrash", "commands", "events", "loaders"].forEach((handler) => {
require(`../handlers/${handler}`)(this);
});
this.cluster = new ClusterClient(this);
}
connect() {
return super.login(this.token);
}
}
module.exports = MainClient;
Editor is loading...
Leave a Comment