This repository has been archived by the owner on Dec 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathindex.js
62 lines (57 loc) · 2.53 KB
/
index.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
const Discord = require('discord.js');
const client = new Discord.Client();
const { prefix, token, nsfw_channel_only } = require('./config.json');
let fs = require('fs');
const nekoclient = require('nekos.life');
const neko = new nekoclient();
client.on('ready', () => {
console.log(`Bot tag: ${client.user.tag}`);
console.log(`Guilds: ${client.guilds.cache.size}`);
client.user.setActivity(`with ${prefix}help`, { type: 'PLAYING' });
});
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync('./commands/').filter(file => file.endsWith('.js'));
for(const file of commandFiles) {
const command = require(`./commands/${file}`);
client.commands.set(command.name, command);
}
client.on('message', async message => {
if (!message.content.startsWith(`${prefix}help`)) {
if (message.content.startsWith(`${prefix}`)) {
if (nsfw_channel_only === 'true') {
if (message.channel.nsfw) {
let file_name = `${message.content.split(' ')[0].replace(prefix, '')}.js`;
if(!fs.existsSync('./commands/' + file_name)) return undefined;
if(fs.existsSync('./commands/' + file_name)) {
client.commands.get(file_name.replace('.js', '')).execute(client, message);
}
}
if (!message.channel.nsfw) {
let embed = new Discord.MessageEmbed()
.setAuthor(message.author.username, message.author.displayAvatarURL({ format: 'png', dynamic: true, size: 1024 }), 'https://discordapp.com/oauth2/authorize?client_id=648959516016377896&scope=bot&permissions=66321471')
.setTimestamp()
.setColor('#D15252')
.setTitle('📛 Error: Denied')
.setDescription('This command is only allowed in **NSFW** channels.')
.setFooter(message.author.tag)
message.channel.send(embed);
}
}
if (nsfw_channel_only === 'false') {
let file_name = `${message.content.split(' ')[0].replace(prefix, '')}.js`;
if(!fs.existsSync('./commands/' + file_name)) return undefined;
if(fs.existsSync('./commands/' + file_name)) {
client.commands.get(file_name.replace('.js', '')).execute(client, message);
}
}
}
}
if (message.content.startsWith(`${prefix}help`)) {
let file_name = `${message.content.split(' ')[0].replace(prefix, '')}.js`;
if(!fs.existsSync('./commands/' + file_name)) return undefined;
if(fs.existsSync('./commands/' + file_name)) {
client.commands.get(file_name.replace('.js', '')).execute(client, message);
}
}
});
client.login(token);