forked from zhenyar123/music..v12
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
205 lines (177 loc) · 7.72 KB
/
index.js
File metadata and controls
205 lines (177 loc) · 7.72 KB
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
const Discord = require(`discord.js`);
const { Client, Collection, MessageEmbed,MessageAttachment } = require(`discord.js`);
const { readdirSync } = require(`fs`);
const { join } = require(`path`);
const db = require('quick.db');
const { TOKEN, PREFIX, AVATARURL, BOTNAME, } = require(`./config.json`);
const figlet = require("figlet");
const client = new Client({ disableMentions: `` , partials: ['MESSAGE', 'CHANNEL', 'REACTION'] });
client.login('ODMwMTM3Mzc1MDEwOTc5ODcw.YHCTrQ.H1OQcEqwYb9NGamvNUGt0eRyK4Y');
client.commands = new Collection();
client.setMaxListeners(0);
client.prefix = PREFIX;
client.queue = new Map();
const cooldowns = new Collection();
const escapeRegex = (str) => str.replace(/[.*+?^${}()|[\]\\]/g, `\\$&`);
//this fires when the BOT STARTS DO NOT TOUCH
client.on(`ready`, () => {
//////////////
////////
///////////////////////////////
////////////IFCHEMPTY//////////
//remove everything in between those 2 big comments if you want to disable that the bot leaves when ch. or queue gets empty!
setInterval(() => {
let member;
client.guilds.cache.forEach(async guild =>{
await delay(15);
member = await client.guilds.cache.get(guild.id).members.cache.get(client.user.id)
//if not connected
if(!member.voice.channel)
return;
//if alone
if (member.voice.channel.members.size === 1)
{ return member.voice.channel.leave(); }
});
client.user.setActivity(`Type: ${PREFIX}help - Music Is One`, { type: "LISTENING"});
client.user.setActivity(`Type: GuIdis ${client.guilds.cache.size},Users ${client.guilds.cache.reduce((a, g) => a + g.memberCount, 0)},`, { type: "LISTENING"});
}, (5000));
////////////////////////////////
////////////////////////////////
figlet.text(`${client.user.username} ready!`, function (err, data) {
if (err) {
console.log('Something went wrong');
console.dir(err);
}
console.log(`═════════════════════════════════════════════════════════════════════════════`);
console.log(data)
console.log(`═════════════════════════════════════════════════════════════════════════════`);
})
});
//DO NOT TOUCH
//FOLDERS:
//Admin custommsg data FUN General Music NSFW others
commandFiles = readdirSync(join(__dirname, `Music`)).filter((file) => file.endsWith(`.js`));
for (const file of commandFiles) {
const command = require(join(__dirname, `Music`, `${file}`));
client.commands.set(command.name, command);
}
commandFiles = readdirSync(join(__dirname, `others`)).filter((file) => file.endsWith(`.js`));
for (const file of commandFiles) {
const command = require(join(__dirname, `others`, `${file}`));
client.commands.set(command.name, command);
}
//COMMANDS //DO NOT TOUCH
client.on(`message`, async (message) => {
if (message.author.bot) return;
//getting prefix
let prefix = await db.get(`prefix_${message.guild.id}`)
//if not prefix set it to standard prefix in the config.json file
if(prefix === null) prefix = PREFIX;
//information message when the bot has been tagged
if(message.content.includes(client.user.id)) {
message.reply(new Discord.MessageEmbed().setColor("YELLOW").setAuthor(`${message.author.username}, My Prefix is ${prefix}, to get started; type ${prefix}help`, message.author.displayAvatarURL({dynamic:true})));
}
//An about announcement for everyone but no one knows so fine ^w^
if(message.content.startsWith(`${prefix}about`)){
//define saymsg
const saymsg = message.content.slice(Number(prefix.length) + 5)
//define embed
const embed = new Discord.MessageEmbed()
.setColor("YELLOW")
.setAuthor("About Zooya Bot.", "https://media.discordapp.net/attachments/815252825012568085/815266512414703656/image0.png")
.setThumbnail(`https://media.discordapp.net/attachments/815252825012568085/815266512414703656/image0.png `)
.setFooter(message.author.username, message.author.displayAvatarURL)
.setTimestamp()
.setDescription(`
[Support](https://discord.gg/tzkTPQBRde) - [Invite](https://discord.com/api/oauth2/authorize?client_id=830137375010979870&permissions=8&scope=bot)
**Developers Bot** :
KILLUA
**Set Status** :
Online
**Time Create** :
25/1/2021
**Prefix Bot** :
c?
`)
//send the Message
message.channel.send(embed)
message.react("<:verify:830139108403576833>")
}
//An suuport announcement for everyone but no one knows so fine ^w^
if(message.content.startsWith(`${prefix}support`)){
//define saymsg
const saymsg = message.content.slice(Number(prefix.length) + 5)
//define embed
const embed = new Discord.MessageEmbed()
.setColor("YELLOW")
.setDescription (`
Links
[Support](https://discord.gg/tzkTPQBRde)
-
[Invite](https://discord.com/api/oauth2/authorize?client_id=830137375010979870&permissions=8&scope=bot)`)
.setFooter(message.author.username, message.author.displayAvatarURL)
.setImage(``)
.setTitle(`**Support Zooya**`)
.setThumbnail(`https://media.discordapp.net/attachments/809000331807424512/814581827192881152/image0.png`)
.setTimestamp()
//send the Message
message.channel.send(embed)
message.react("<:zooya:830141606026805278>")
}
//An embed announcement for everyone but no one knows so fine ^w^
if(message.content.startsWith(`${prefix}embed`)){
//define saymsg
const saymsg = message.content.slice(Number(prefix.length) + 5)
//define embed
const embed = new Discord.MessageEmbed()
.setColor("YELLOW")
.setDescription(saymsg)
//delete the Command
message.delete({timeout: 300})
//send the Message
message.channel.send(embed)
}
//command Handler DO NOT TOUCH
const prefixRegex = new RegExp(`^(<@!?${client.user.id}>|${escapeRegex(prefix)})\\s*`);
if (!prefixRegex.test(message.content)) return;
const [, matchedPrefix] = message.content.match(prefixRegex);
const args = message.content.slice(matchedPrefix.length).trim().split(/ +/);
const commandName = args.shift().toLowerCase();
const command =
client.commands.get(commandName) ||
client.commands.find((cmd) => cmd.aliases && cmd.aliases.includes(commandName));
if (!command) return;
if (!cooldowns.has(command.name)) {
cooldowns.set(command.name, new Collection());
}
const now = Date.now();
const timestamps = cooldowns.get(command.name);
const cooldownAmount = (command.cooldown || 1) * 1000;
if (timestamps.has(message.author.id)) {
const expirationTime = timestamps.get(message.author.id) + cooldownAmount;
if (now < expirationTime) {
const timeLeft = (expirationTime - now) / 1000;
return message.reply(
new MessageEmbed().setColor("YELLOW")
.setTitle(`\`Please wait\` \`${timeLeft.toFixed(1)} seconds\` \`before reusing the\` \`${prefix}${command.name}\` `)
);
}
}
timestamps.set(message.author.id, now);
setTimeout(() => timestamps.delete(message.author.id), cooldownAmount);
try {
command.execute(message, args, client);
} catch (error) {
console.error(error);
message.reply( new MessageEmbed().setColor("YELLOW")
.setTitle(`There was an error executing that command.`)).catch(console.error);
}
});
function delay(delayInms) {
return new Promise(resolve => {
setTimeout(() => {
resolve(2);
}, delayInms);
});
}
//Bot coded by