From e1f11a98b823c1c9ae48330ce5f61f493758fccf Mon Sep 17 00:00:00 2001
From: Nanotect <61177761+Adivise@users.noreply.github.com>
Date: Sun, 7 Aug 2022 14:13:19 +0700
Subject: [PATCH 1/6] `Update` multi-bot login not main branch!
---
.env.example | 3 --
config.json.example | 13 +++++++
disspace.js | 58 ------------------------------
events/client/ready.js | 21 ++++-------
events/client/shardDisconnect.js | 2 +-
events/client/shardError.js | 2 +-
events/client/shardReady.js | 4 +--
events/client/shardReconnecting.js | 2 +-
events/client/shardResume.js | 2 +-
events/guild/messageCreate.js | 2 +-
handlers/loadCommands.js | 4 +--
handlers/loadDistube.js | 4 +--
handlers/loadEvents.js | 4 +--
index.js | 58 +++++++++++++++++++++++++++---
package.json | 2 --
settings/config.js | 7 ----
16 files changed, 87 insertions(+), 101 deletions(-)
delete mode 100644 .env.example
create mode 100644 config.json.example
delete mode 100644 disspace.js
delete mode 100644 settings/config.js
diff --git a/.env.example b/.env.example
deleted file mode 100644
index f67b0930..00000000
--- a/.env.example
+++ /dev/null
@@ -1,3 +0,0 @@
-TOKEN=replace_on_here
-PREFIX=#
-OWNER_ID=replace_on_here
\ No newline at end of file
diff --git a/config.json.example b/config.json.example
new file mode 100644
index 00000000..d9d21f93
--- /dev/null
+++ b/config.json.example
@@ -0,0 +1,13 @@
+{
+ "TOKEN": [
+ "TOKEN_BOT_1",
+ "TOKEN_BOT_2",
+ "TOKEN_BOT_3"
+ ],
+ "PREFIX": [
+ "-",
+ "+",
+ "!"
+ ],
+ "OWNER_ID": "YOUR_DISCORD_ID"
+}
\ No newline at end of file
diff --git a/disspace.js b/disspace.js
deleted file mode 100644
index 8fa4e0dd..00000000
--- a/disspace.js
+++ /dev/null
@@ -1,58 +0,0 @@
-const { Client, Collection, GatewayIntentBits } = require("discord.js");
-const { DisTube } = require('distube');
-const { SoundCloudPlugin } = require('@distube/soundcloud');
-const { SpotifyPlugin } = require('@distube/spotify');
-const { YtDlpPlugin } = require("@distube/yt-dlp");
-
-
-class MainClient extends Client {
- constructor() {
- super({
- shards: "auto",
- intents: [
- GatewayIntentBits.Guilds,
- GatewayIntentBits.GuildMembers,
- GatewayIntentBits.GuildMessages,
- GatewayIntentBits.GuildVoiceStates,
- GatewayIntentBits.MessageContent,
- ],
- allowedMentions: {
- parse: ["roles", "users", "everyone"],
- repliedUser: false
- },
- });
-
- process.on('unhandledRejection', error => console.log(error));
- process.on('uncaughtException', error => console.log(error));
-
- this.config = require('./settings/config.js');
- this.prefix = this.config.PREFIX;
- this.owner = this.config.OWNER_ID;
- if (!this.token) this.token = this.config.TOKEN;
-
- const client = this;
-
- this.distube = new DisTube(client, {
- searchSongs: 0, /// SET TO 5 FOR ENABLE SEARCH MODE!
- searchCooldown: 30,
- leaveOnEmpty: true,
- emptyCooldown: 60,
- leaveOnFinish: true,
- leaveOnStop: true,
- plugins: [
- new SoundCloudPlugin(),
- new SpotifyPlugin({
- emitEventsAfterFetching: true
- }),
- new YtDlpPlugin()],
- });
-
- ["aliases", "commands"].forEach(x => client[x] = new Collection());
- ["loadCommands", "loadEvents", "loadDistube"].forEach(x => require(`./handlers/${x}`)(client));
-
- }
- connect() {
- return super.login(this.token);
- };
-};
-module.exports = MainClient;
\ No newline at end of file
diff --git a/events/client/ready.js b/events/client/ready.js
index 0f2ef0e1..33682b7e 100644
--- a/events/client/ready.js
+++ b/events/client/ready.js
@@ -1,15 +1,5 @@
-const figlet = require('figlet');
-const chalk = require('chalk');
-
module.exports = async (client) => {
- figlet(client.user.tag, function(err, data) {
- if (err) {
- console.log('Something went wrong...');
- console.dir(err);
- return;
- }
- console.log(chalk.red.bold(data));
- });
+ console.log(`Logged in as ${client.user.tag}!`);
let guilds = client.guilds.cache.size;
let users = client.users.cache.size;
@@ -21,7 +11,10 @@ module.exports = async (client) => {
`${client.prefix}filterlist | ${channels} channels`,
]
- setInterval(() => {
- client.user.setActivity(`${activities[Math.floor(Math.random() * activities.length)]}`, { type: 'WATCHING' });
- }, 15000)
+ setInterval(() => {
+ client.user.setPresence({
+ activities: [{ name: `${activities[Math.floor(Math.random() * activities.length)]}`, type: 2 }],
+ status: 'online',
+ });
+ }, 15000);
}
diff --git a/events/client/shardDisconnect.js b/events/client/shardDisconnect.js
index 47b4fc19..fbda09e4 100644
--- a/events/client/shardDisconnect.js
+++ b/events/client/shardDisconnect.js
@@ -1,5 +1,5 @@
const chalk = require("chalk");
module.exports = (client, event, id) => {
- console.log(chalk.redBright(`[${String(new Date).split(" ", 5).join(" ")}] || ==> || Shard #${id} Disconnected`))
+ // console.log(chalk.redBright(`[${String(new Date).split(" ", 5).join(" ")}] || ==> || Shard #${id} Disconnected`))
}
diff --git a/events/client/shardError.js b/events/client/shardError.js
index 342cdd69..ae7d8899 100644
--- a/events/client/shardError.js
+++ b/events/client/shardError.js
@@ -1,5 +1,5 @@
const chalk = require("chalk");
module.exports = (client, error, id) => {
- console.log(chalk.red(`[${String(new Date).split(" ", 5).join(" ")}] || ==> || Shard #${id} Errored`))
+ // console.log(chalk.red(`[${String(new Date).split(" ", 5).join(" ")}] || ==> || Shard #${id} Errored`))
}
diff --git a/events/client/shardReady.js b/events/client/shardReady.js
index 5c99ab00..952a750e 100644
--- a/events/client/shardReady.js
+++ b/events/client/shardReady.js
@@ -2,6 +2,6 @@ const chalk = require("chalk");
const delay = require("delay");
module.exports = async (client, id) => {
- await delay(2000);
- console.log(chalk.greenBright(`[${String(new Date).split(" ", 5).join(" ")}] || ==> || Shard #${id} Ready`))
+ // await delay(2000);
+ // console.log(chalk.greenBright(`[${String(new Date).split(" ", 5).join(" ")}] || ==> || Shard #${id} Ready`))
}
diff --git a/events/client/shardReconnecting.js b/events/client/shardReconnecting.js
index 3a9a219d..7adf25bd 100644
--- a/events/client/shardReconnecting.js
+++ b/events/client/shardReconnecting.js
@@ -1,5 +1,5 @@
const chalk = require("chalk");
module.exports = (client, id) => {
- console.log(chalk.yellowBright(`[${String(new Date).split(" ", 5).join(" ")}] || ==> || Shard #${id} Reconnecting`))
+ // console.log(chalk.yellowBright(`[${String(new Date).split(" ", 5).join(" ")}] || ==> || Shard #${id} Reconnecting`))
}
diff --git a/events/client/shardResume.js b/events/client/shardResume.js
index ee9c6053..5adcdbdf 100644
--- a/events/client/shardResume.js
+++ b/events/client/shardResume.js
@@ -1,5 +1,5 @@
const chalk = require("chalk");
module.exports = (client, id, replayedEvents) => {
- console.log(chalk.yellow(`[${String(new Date).split(" ", 5).join(" ")}] || ==> || Shard #${id} Resumed`))
+ // console.log(chalk.yellow(`[${String(new Date).split(" ", 5).join(" ")}] || ==> || Shard #${id} Resumed`))
}
diff --git a/events/guild/messageCreate.js b/events/guild/messageCreate.js
index 12c26ece..c9ca732b 100644
--- a/events/guild/messageCreate.js
+++ b/events/guild/messageCreate.js
@@ -24,7 +24,7 @@ module.exports = async (client, message) => {
if(!message.guild.members.me.permissions.has(PermissionsBitField.Flags.SendMessages)) return await message.author.dmChannel.send({ content: `I don't have perm **\`SEND_MESSAGES\`** permission in <#${message.channelId}> to execute command!` }).catch(() => {});
if(!message.guild.members.me.permissions.has(PermissionsBitField.Flags.EmbedLinks)) return await message.channel.send({ content: `I don't have perm **\`EMBED_LINKS\`** to execute command!` }).catch(() => {});
- console.log(`[COMMAND] ${command.config.name} executed by ${message.author.tag}`);
+ console.log(`[COMMAND] ${command.config.name} executed by ${message.author.tag} | [${client.user.tag}] in ${message.guild.name} (${message.guild.id})`);
try {
command.run(client, message, args);
diff --git a/handlers/loadCommands.js b/handlers/loadCommands.js
index 71a505ba..fd544906 100644
--- a/handlers/loadCommands.js
+++ b/handlers/loadCommands.js
@@ -12,6 +12,6 @@ module.exports = async (client) => {
};
};
["music", "filters", "utilities"].forEach(x => load(x));
- await delay(4000);
- console.log(chalk.greenBright(`[INFORMATION] Command Events Loaded`));
+ // await delay(4000);
+ // console.log(chalk.greenBright(`[INFORMATION] Command Events Loaded`));
};
\ No newline at end of file
diff --git a/handlers/loadDistube.js b/handlers/loadDistube.js
index 2e7fef93..d331f256 100644
--- a/handlers/loadDistube.js
+++ b/handlers/loadDistube.js
@@ -12,6 +12,6 @@ module.exports = async (client) => {
} catch (e) {
console.log(e);
}
- await delay(4000);
- console.log(chalk.greenBright(`[INFORMATION] Distube Events Loaded`));
+ // await delay(4000);
+ // console.log(chalk.greenBright(`[INFORMATION] Distube Events Loaded`));
};
\ No newline at end of file
diff --git a/handlers/loadEvents.js b/handlers/loadEvents.js
index baf49451..e61a33f5 100644
--- a/handlers/loadEvents.js
+++ b/handlers/loadEvents.js
@@ -12,6 +12,6 @@ module.exports = async (client, message) => {
};
};
["client", "guild"].forEach(x => load(x));
- await delay(4000);
- console.log(chalk.greenBright(`[INFORMATION] Global Events Loaded`));
+ // await delay(4000);
+ // console.log(chalk.greenBright(`[INFORMATION] Global Events Loaded`));
};
\ No newline at end of file
diff --git a/index.js b/index.js
index a596e44a..e4422c71 100644
--- a/index.js
+++ b/index.js
@@ -1,7 +1,57 @@
+const { Client, Collection, GatewayIntentBits } = require("discord.js");
+const { DisTube } = require('distube');
+const { SoundCloudPlugin } = require('@distube/soundcloud');
+const { SpotifyPlugin } = require('@distube/spotify');
+const { YtDlpPlugin } = require("@distube/yt-dlp");
-const MainClient = require("./disspace");
-const client = new MainClient();
+/// Call Config
+const { TOKEN, PREFIX, OWNER_ID } = require("./config.json");
-client.connect()
+process.on('unhandledRejection', error => console.log(error));
+process.on('uncaughtException', error => console.log(error));
-module.exports = client;
\ No newline at end of file
+/// Multi bot login support
+for (let i = 0; i < TOKEN.length ; i++) {
+ const client = new Client({
+ shards: "auto",
+ intents: [
+ GatewayIntentBits.Guilds,
+ GatewayIntentBits.GuildMembers,
+ GatewayIntentBits.GuildMessages,
+ GatewayIntentBits.GuildVoiceStates,
+ GatewayIntentBits.MessageContent,
+ ],
+ allowedMentions: {
+ parse: ["roles", "users", "everyone"],
+ repliedUser: false
+ },
+ });
+
+ client.config = require('./config.json');
+ // Print prefix
+ client.prefix = PREFIX[i];
+ client.owner = OWNER_ID;
+
+ // Print bot token
+ if (!client.token) client.token = TOKEN[i];
+
+ client.distube = new DisTube(client, {
+ searchSongs: 0, /// SET TO 5 FOR ENABLE SEARCH MODE!
+ searchCooldown: 30,
+ leaveOnEmpty: true,
+ emptyCooldown: 60,
+ leaveOnFinish: true,
+ leaveOnStop: true,
+ plugins: [
+ new SoundCloudPlugin(),
+ new SpotifyPlugin({
+ emitEventsAfterFetching: true
+ }),
+ new YtDlpPlugin()],
+ });
+
+ ["aliases", "commands"].forEach(x => client[x] = new Collection());
+ ["loadCommands", "loadEvents", "loadDistube"].forEach(x => require(`./handlers/${x}`)(client));
+
+ client.login(client.token);
+}
\ No newline at end of file
diff --git a/package.json b/package.json
index 396331ee..4b9cdd23 100644
--- a/package.json
+++ b/package.json
@@ -18,9 +18,7 @@
"delay": "^5.0.0",
"discord.js": "^14.1.2",
"distube": "^4.0.3",
- "dotenv": "^14.3.2",
"ffmpeg-static": "^4.4.1",
- "figlet": "^1.5.2",
"libsodium-wrappers": "^0.7.9",
"lyrics-finder": "^21.7.0",
"opusscript": "^0.0.8"
diff --git a/settings/config.js b/settings/config.js
deleted file mode 100644
index 10c2d2c1..00000000
--- a/settings/config.js
+++ /dev/null
@@ -1,7 +0,0 @@
-require("dotenv").config();
-
-module.exports = {
- TOKEN: process.env.TOKEN || "YOUR_TOKEN", // your bot token
- PREFIX: process.env.PREFIX || "#", //<= default is # // bot prefix
- OWNER_ID: process.env.OWNER_ID || "YOUR_CLIENT_ID", //your client id
-}
\ No newline at end of file
From 583241bc2c3d3690c87c033e7c967f304a4661bd Mon Sep 17 00:00:00 2001
From: Nanotect <61177761+Adivise@users.noreply.github.com>
Date: Sun, 7 Aug 2022 14:19:16 +0700
Subject: [PATCH 2/6] Update README.md
---
README.md | 23 +++++++++++++++++------
1 file changed, 17 insertions(+), 6 deletions(-)
diff --git a/README.md b/README.md
index 58585029..575113cb 100644
--- a/README.md
+++ b/README.md
@@ -4,6 +4,7 @@
- [x] MessageButton
- [x] No Database
- [x] Easy to use
+- [x] Multi Bot Login (Per Prefix!)
## 🎶 Support Source
- [x] Youtube
@@ -32,12 +33,22 @@ After installation finishes you can use `node .` to start the bot. or `Run Start
## 📚 Configuration
-Copy or Rename `.env.example` to `.env` and fill out the values:
-
-```.env
-TOKEN=replace_on_here
-PREFIX=!
-OWNER_ID=replace_on_here
+Copy or Rename `config.json.example` to `config.json` and fill out the values:
+
+```json
+{
+ "TOKEN": [
+ "TOKEN_BOT_1",
+ "TOKEN_BOT_2",
+ "TOKEN_BOT_3"
+ ],
+ "PREFIX": [
+ "-",
+ "+",
+ "!"
+ ],
+ "OWNER_ID": "YOUR_DISCORD_ID"
+}
```
## 📄 Features & Commands
From b23287857b41f4ff90f7f2f3fd58a7c82f83cb92 Mon Sep 17 00:00:00 2001
From: Nanotect <61177761+Adivise@users.noreply.github.com>
Date: Sun, 7 Aug 2022 14:21:50 +0700
Subject: [PATCH 3/6] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 575113cb..70fbde56 100644
--- a/README.md
+++ b/README.md
@@ -4,7 +4,7 @@
- [x] MessageButton
- [x] No Database
- [x] Easy to use
-- [x] Multi Bot Login (Per Prefix!)
+- [x] Multi Bot Login (Per Prefix!) [Unlimited Bot Added]
## 🎶 Support Source
- [x] Youtube
From 2100c9b42b8570b51514342de97611e05db5ab13 Mon Sep 17 00:00:00 2001
From: Nanotect <61177761+Adivise@users.noreply.github.com>
Date: Mon, 8 Aug 2022 10:58:48 +0700
Subject: [PATCH 4/6] `Fixed` autoplay.js
---
commands/music/autoplay.js | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/commands/music/autoplay.js b/commands/music/autoplay.js
index 52a5480f..67e9e3e4 100644
--- a/commands/music/autoplay.js
+++ b/commands/music/autoplay.js
@@ -20,16 +20,16 @@ module.exports = {
client.distube.toggleAutoplay(message);
const embed = new EmbedBuilder()
- .setColor(message.client.color)
- .setDescription(`\`⏯\` Activate **Autoplay** mode.`)
+ .setColor("#000001")
+ .setDescription(`\`⏯\` Activate **Autoplay** mode.`);
msg.edit({ content: ' ', embeds: [embed] });
} else {
client.distube.toggleAutoplay(message);
const embed = new EmbedBuilder()
- .setColor(message.client.color)
- .setDescription(`\`⏯\` Disable **Autoplay** mode.`)
+ .setColor("#000001")
+ .setDescription(`\`⏯\` Disable **Autoplay** mode.`);
msg.edit({ content: ' ', embeds: [embed] });
}
From 949a19af23ba252c4c3d7ce4f63fe6983abed8b6 Mon Sep 17 00:00:00 2001
From: Nanotect <61177761+Adivise@users.noreply.github.com>
Date: Sun, 11 Sep 2022 15:05:24 +0700
Subject: [PATCH 5/6] `Fixed` queue.js
---
commands/music/queue.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/commands/music/queue.js b/commands/music/queue.js
index b9147d3c..90e0dbd5 100644
--- a/commands/music/queue.js
+++ b/commands/music/queue.js
@@ -13,7 +13,7 @@ module.exports = {
const queue = client.distube.getQueue(message);
if (!queue) message.channel.send(`There is nothing in the queue right now!`)
const { channel } = message.member.voice;
- if (!channel || message.member.voice.channel !== message.guild.me.voice.channel) return message.channel.send("You need to be in a same/voice channel.")
+ if (!channel || message.member.voice.channel !== message.guild.members.me.voice.channel) return message.channel.send("You need to be in a same/voice channel.")
const pagesNum = Math.ceil(queue.songs.length / 10);
if(pagesNum === 0) pagesNum = 1;
From c8a3f3d5f78d0ad3d6f14f565400119724fd7db6 Mon Sep 17 00:00:00 2001
From: Nanotect <61177761+Adivise@users.noreply.github.com>
Date: Mon, 12 Sep 2022 14:24:19 +0700
Subject: [PATCH 6/6] `Fixed` ready.js (Presence Status)
---
events/client/ready.js | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/events/client/ready.js b/events/client/ready.js
index 33682b7e..347295d1 100644
--- a/events/client/ready.js
+++ b/events/client/ready.js
@@ -1,20 +1,20 @@
module.exports = async (client) => {
- console.log(`Logged in as ${client.user.tag}!`);
+ console.log(`Logged in as ${client.user.tag}!`);
- let guilds = client.guilds.cache.size;
- let users = client.users.cache.size;
- let channels = client.channels.cache.size;
+ let guilds = client.guilds.cache.size;
+ let users = client.users.cache.size;
+ let channels = client.channels.cache.size;
- const activities = [
- `${client.prefix}help | ${guilds} servers`,
- `${client.prefix}play | ${users} users`,
- `${client.prefix}filterlist | ${channels} channels`,
- ]
+ const activities = [
+ `${client.prefix}help | ${guilds} servers`,
+ `${client.prefix}play | ${users} users`,
+ `${client.prefix}filterlist | ${channels} channels`,
+ ];
setInterval(() => {
- client.user.setPresence({
- activities: [{ name: `${activities[Math.floor(Math.random() * activities.length)]}`, type: 2 }],
- status: 'online',
- });
- }, 15000);
+ client.user.setPresence({
+ activities: [{ name: `${activities[Math.floor(Math.random() * activities.length)]}`, type: 2 }],
+ status: 'online',
+ });
+ }, 15000)
}