Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js')
- const bot = new Discord.Client();
- const prefix = '.'
- const fs = require('fs');
- //We can call the JSON file here
- const commands = JSON.parse(fs.readFileSync('Storage/commands.json', 'utf8'));
- bot.on('message', message => {
- let msg = message.content.toUpperCase();
- let sender = message.author;
- let cont = message.content.slice(prefix.length).split(" ");
- let args = cont.slice(1);
- // Commands
- //Ping
- if (msg === prefix + 'PING') {
- //Purge
- if (msg.startsWith(prefix + 'PURGE')) {
- // Weather Command
- // .
- if (msg.startsWith(prefix + 'WEATHER')) {
- // This episode will be going over the hook command
- if (msg.startsWith(prefix + 'HOOK')) {
- // Help
- if (msg.startsWith(prefix + 'HELP')) {
- if (msg === `${prefix}HELP`) {
- const embed = new Discord.RichEmbed()
- .setColor(0x1D82B6)
- //Variables
- let commandsFound = 0;
- // .
- for (var cmd in commands) {
- if (commands[cmd].group.toUpperCase() === 'USER') {
- //.
- commandsFound++
- //.
- embed.addField(`${commands[cmd].name}`, `**Description:** ${commands[cmd].desc}\n**Usage:** ${prefix + commands[cmd].usage}`);
- }
- //.
- }
- //.
- embed.setFooter(`Currently showing user commands. To view another group do ${prefix}help [group / command]`)
- embed.setDescription(`**${commandsFound} commands found** - <> means required, [] means optional`);
- //.
- message.author.send({embed})
- //.
- message.channel.send({embed: {
- color: 0x1D82B6,
- description: `**Check your DMs ${message.author}!**`
- }})
- //.
- //.
- //.
- } else {
- // .
- //Variables
- let groupFound = '';
- for (var cmd in commands) {
- if (args.join(" ").trim().toUpperCase() === commands[cmd].group.toUpperCase()) {
- groupFound = commands[cmd].group.toUpperCase();
- }
- }
- if (groupFound != '') {
- const embed = new Discord.RichEmbed()
- .setColor(0x1D82B6)
- //Variables
- let commandsFound = 0;
- for (var cmd in commands) {
- if (commands[cmd].group.toUpperCase() === groupFound) {
- //.
- commandsFound++
- //.
- embed.addField(`${commands[cmd].name}`, `**Description:** ${commands[cmd].desc}\n**Usage:** ${prefix + commands[cmd].usage}`);
- }
- }
- //.
- embed.setFooter(`Currently showing ${groupFound} commands. To view another group do ${prefix}help [group / command]`)
- embed.setDescription(`**${commandsFound} commands found** - <> means required, [] means optional`);
- //.
- message.author.send({embed})
- //.
- message.channel.send({embed: {
- color: 0x1D82B6,
- description: `**Check your DMs ${message.author}!**`
- }})
- //.
- }
- }
- }
- }
- }
- }
- }
- });
- bot.on('ready', () => {
- //.
- console.log(`${bot.user.username} is ingelogd bij StormCompany`)
- });
- bot.login('NjYyNTcwMzg4MTQ3OTI5MDg4.Xg9dSQ.FzV2eeEov5aS4cfuGp9snWDZM4Q')
- Commands
- {
- "Help": {
- "name": "Help",
- "group": "User",
- "desc": "Displays a list of commands",
- "usage": "help [group OR command]"
- },
- "Hook": {
- "name": "Hook",
- "group": "User",
- "desc": "Returns a hook in the channel",
- "usage": "hook <title>,<description>,[color],[avatarURL]"
- },
- "Weather": {
- "name": "Weather",
- "group": "User",
- "desc": "Returns the weather in the channel",
- "usage": "weather <location>"
- },
- "Purge": {
- "name": "Purge",
- "group": "Moderator",
- "desc": "Clears a specified number of messages",
- "usage": "purge <messages>"
- },
- "Ping": {
- "name": "Ping",
- "group": "Admin",
- "desc": "Returns the ping to the channel",
- "usage": "ping"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement