Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const botconfig = require("./botconfig.json");
- const Discord = require("discord.js");
- const fs = require("fs");
- const bot = new Discord.Client({disableEveryone: true});
- bot.commands = new Discord.Collection();
- fs.readdir("./commands/", (err, file) => {
- if(err) console.log(err);
- let jsfile = file.filter(f => f.split(".").pop() === "js")
- if(jsfile.length <= 0){
- console.log("Couldn't find commands.");
- return;
- }
- jsfile.forEach((f, i) =>{
- let props = require(`./commands/${f}`);
- console.log(`${f} Loaded!`);
- bot.commands.set(props.help.name, props);
- });
- });
- bot.on("ready", async () => {
- console.log(`${bot.user.username} is online`)
- bot.user.setActivity("!help");
- });
- bot.on("message", async message => {
- if(message.author.bot) return;
- if(message.channel.type === "dm") return;
- let prefix = botconfig.prefix;
- let messageArray = message.content.split(" ");
- let cmd = messageArray[0];
- let args = messageArray.slice(1);
- let commandfile = bot.commands.get(cmd.slice(prefix.length));
- if(commandfile) commandfile.run(bot,message,args);
- if(cmd === `${prefix}help`){
- let bicon = bot.user.displayAvatarURL;
- let botembed = new Discord.RichEmbed()
- .setDescription("Hello welcome to the Silkyy marketplace, here are a list of commands!")
- .setColor("EBD61D")
- .setThumbnail(bicon)
- .addField("!ban", 'bans a specific user')
- .addField("!kick", 'kicks a specific user')
- .addField("!clear", 'clears unwanted messages')
- .addField("!report", 'report actions against the rules!')
- .addField("!avatar", 'take a closer look to an avatar!')
- .addField("!open", 'open a ticket for support');
- return message.channel.send(botembed);
- }
- });
- bot.on('guildMemberAdd', member => {
- // Send the message to a designated channel on a server:
- const channel = member.guild.channels.find(ch => ch.name === 'join-logs');
- // Do nothing if the channel wasn't found on this server
- if (!channel) return;
- // Send the message, mentioning the member
- let sicon = bot.user.displayAvatarURL;
- let welcomeembed = new Discord.RichEmbed()
- .setTitle(`Welcome to the server, ${member}`)
- .setColor("#ff0000")
- .setThumbnail(sicon)
- .addField("IP:", "**Coming soon**")
- .addField("Release Date:", "**To be confirmed**")
- channel.send(welcomeembed)
- });
- bot.login(botconfig.token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement