-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathv3.js
218 lines (216 loc) · 7.9 KB
/
v3.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
require("dotenv").config();
const {
Client,
Collection,
MessageEmbed,
Intents,
Permissions,
} = require("discord.js");
const { readdirSync } = require("fs");
const AutoPoster = require("topgg-autoposter");
const { Player } = require("discord-player");
const client = new Client({
intents: [
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_VOICE_STATES,
],
allowedMentions: { repliedUser: false },
});
module.exports = client;
client.commands = new Collection();
client.preifx = ".";
const files = readdirSync("./v3commands").filter((file) =>
file.endsWith(".js")
);
for (const file of files) {
const command = require(`./v3commands/${file}`);
client.commands.set(command.name, command);
}
client.embed = require("./embed");
client.error = require("./error");
client.check = require(`./check`);
client.emoji = `<:SimpleMusicBotCircular:881970577873731654>`;
const player = new Player(client, {
ytdlOptions: {
requestOptions: {
headers: {
cookie:
"VISITOR_INFO1_LIVE=915lzshV3p8; PREF=f4=4000000&tz=Asia.Calcutta&f6=40000000; GPS=1; YSC=jh6w7uj-at4; SID=FgjBn_cT2LI0aYX07v7DGuio6u_LeulKsw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yRHHQy0of_s03etIHANMnOf-O-KQ; __Secure-3PSIDCC=AJi4QfFUCk3EaZs2DsaUuWlrpsZ0N5f4rqxgoWPUApuOhgZ22lGi_oa4FN6ESB7v6Nbekypz9A",
},
},
},
leaveOnEnd: false,
leaveOnStop: false,
leaveOnEmptyCooldown: 60000,
});
client.player = player;
client.player
.on("trackStart", (queue, track) =>
queue.metadata.channel.send({
embeds: [
client
.embed(`**Now Playing :**\n\`\`\`fix\n${track.title}\`\`\``)
.setFooter(
`Requested By ${track.requestedBy.tag}`,
track.requestedBy.avatarURL({
format: "png",
size: 4096,
dynamic: true,
})
),
],
})
)
.on("trackAdd", (queue, track) =>
queue.metadata.channel.send({
embeds: [
client
.embed(`**Song Added :**\`\`\`fix\n${track.title}\`\`\``)
.setFooter(
`Requested By ${track.requestedBy.tag}`,
track.requestedBy.avatarURL({
format: "png",
size: 4096,
dynamic: true,
})
),
],
})
)
.on("queueEnd", (queue) =>
queue.metadata.channel.send({
embeds: [client.embed("```The Queue Has Ended!```")],
})
)
.on("botDisconect", (queue) =>
queue.metadata.channel.send({
embeds: [client.embed("```VC Disconnected!```")],
})
)
.on("channelEmpty", (query) =>
query.metadata.channel.send({
embeds: [client.embed("```The VC Is Empty!```")],
})
)
.on("error", (queue, error) =>
queue.metadata.channel.send({
embeds: [client.embed(`\`\`\`diff\n- ${error}\`\`\``)],
})
);
client.once("ready", () => {
console.log(
`Bot Has Logged In And Is Playing Music! \nSimple Music Bot Is In ${client.guilds.cache.size} Servers! \n${client.users.cache.size} People Are Using Simple Music Bot! \nTotal Channels : ${client.channels.cache.size}!`
);
client.user.setActivity(`Simplicity | .help | Simply Simple Music Bot!`, {
type: "LISTENING",
});
// client.user.setActivity(`Simplicity | Type .help | I Am in ${client.guilds.cache.size} Servers! & ${client.users.cache.size} People Are Using Me!`, { type: "LISTENING" });
});
client.on("messageCreate", async (message) => {
if (
!message.content.startsWith(client.preifx) ||
!message.guild ||
message.author.bot
)
return;
if (
!message.guild.me
.permissionsIn(message.channel)
.has(Permissions.FLAGS.SEND_MESSAGES)
)
return;
const [name, ...args] = message.content.slice(1).split(/\s+/g);
const command = client.commands.get(name);
if (!command) return;
try {
command.run(client, message, args);
client.channels.cache
.get("850294318290829372")
.send(
`Someone Used \`${command.name}\` Command In **${message.guild.name}**!`
);
} catch (err) {
client.error(
message,
`An Error Occurred While Running The Command : ${err.message}`
);
client.channels.cache.get("850294318290829372").send({
embeds: [
client.embed(
`An Error Occured While Executing The \`${command.name}\` Command In **${message.guild.name}!**\n\`\`\`${err.stack}\`\`\``
),
],
});
}
});
client.on(`messageCreate`, (message) => {
if (
message.content === `<@${client.user.id}>` ||
message.content === `<@!${client.user.id}>`
)
return message.reply({
embeds: [
client.embed(
`\`\`\`js\nMy Prefix Is '.'\nType '.help' To Get Started!\`\`\``
),
],
});
});
const logsChannel = "811499611285225492";
client.on("guildCreate", (guild) => {
client.channels.cache.get(logsChannel).send({
embeds: [
new MessageEmbed()
.setTitle("New Server!")
.setThumbnail(guild.iconURL({ size: 4096, dynamic: true }))
.addField("Name :", `\`\`\`${guild.name}\`\`\``, true)
.addField("Server ID :", `\`\`\`${guild.id}\`\`\``, true)
.addField("Members :", `\`\`\`${guild.memberCount}\`\`\``, true)
.addField("Emojis :", `\`\`\`${guild.emojis?.cache.size}\`\`\``, true)
.addField(
"Channels :",
`\`\`\`${guild.channels.cache.size}\`\`\``,
true
)
.addField("Owner ID :", `\`\`\`${guild.ownerID}\`\`\``, true)
.addField("Owner :", `${guild.owner}`, true)
.setFooter(`Currently In ${client.guilds.cache.size} Servers!`)
.setTimestamp()
.setColor("#2F3136"),
],
});
});
client.on("guildDelete", (guild) => {
client.channels.cache.get(logsChannel).send({
embeds: [
new MessageEmbed()
.setTitle("Server Removed!")
.setThumbnail(guild.iconURL({ size: 4096, dynamic: true }))
.setDescription("Guild Info :")
.addField("Name :", `\`\`\`${guild.name}\`\`\``, true)
.addField("Server ID :", `\`\`\`${guild.id}\`\`\``, true)
.addField("Members :", `\`\`\`${guild.memberCount}\`\`\``, true)
.addField("Emojis :", `\`\`\`${guild.emojis?.cache.size}\`\`\``, true)
.addField(
"Channels :",
`\`\`\`${guild.channels.cache.size}\`\`\``,
true
)
.addField("Owner ID :", `\`\`\`${guild.ownerID}\`\`\``, true)
.addField("Owner :", `${guild.owner}`, true)
.setFooter(`Currently In ${client.guilds.cache.size} Servers!`)
.setColor("#2F3136")
.setTimestamp(),
],
});
});
const ap = AutoPoster(process.env.TOPGG_TOKEN, client);
ap.on("posted", () => {
console.log("Posted Stats to Top.gg");
});
process.on("uncaughtException", function (err) {
console.log("caught exception: " + err);
});
client.login(process.env.DISCORD_BOT_TOKEN);
// client.login('NzgwNjgyMjAzNzYyOTE3NDA3.X7yo9Q.B6UJ6MdOWMiwiS7G_zV1TIZmOV8') // for testing purposes...