Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require("discord.js");
- var eightball = [ // sets the answers to an eightball
- "yes!",
- "no...",
- "maybe?",
- "probably",
- "I don't think so.",
- "never!",
- "you can try...",
- "up to you!",
- ]
- const bot = new Discord.Client();
- const settings = require("./settings.json");
- bot.on("ready", () => {
- console.log(`Started! Welcome back, Wetzu`);
- bot.user.setActivity('/shrug | >:help');
- bot.user.setStatus("dnd")
- });
- bot.on("message", async message => {
- if(message.author.bot) return;
- var prefix = settings.prefix
- const args = message.content.slice(settings.prefix.length).trim().split(/ +/g);
- const command = args.shift().toLowerCase();
- if(command === "ping") {
- const m = await message.channel.send("`Please wait...`");
- m.edit(`*Pong!* Latency is ${m.createdTimestamp - message.createdTimestamp}ms. API Latency is ${Math.round(bot.ping)}ms `);
- }
- if (command == "8ball") { // creates the command 8ball
- if (args[1] != null) message.reply(eightball[Math.floor(Math.random() * eightball.length).toString(16)]); // if args[1], post random answer
- else message.channel.send("Ummmm, what is your question? :rolling_eyes: (Correct usage: *8ball [question])"); // if not, error
- }
- if (command == "cookie") { // creates the command cookie
- if (args[1]) message.channel.send(message.author.toString() + " has given " + args[1].toString() + " a cookie! :cookie:") // sends the message saying someone has given someone else a cookie if someone mentions someone else
- else message.channel.send("Who do you want to send a cookie to? :cookie: (Correct usage: *cookie @username)") // sends the error message if no-one is mentioned
- }
- if(command === "say") {
- const sayMessage = args.join(" ");
- message.delete().catch(O_o=>{});
- message.channel.send(sayMessage);
- if(command === "kick") {
- if(!message.member.roles.some(r=>["Administrator", "Moderator", "administrator", "Owner"].includes(r.name)) )
- return message.reply(":no_entry_sign: You have no permission to use this command.");
- let member = message.mentions.members.first();
- if(!member)
- return message.reply("Please mention a specific member in the server,");
- if(!member.kickable)
- return message.reply(":no_entry_sign: I cannot kick this user, Perhaps this member has a higher role.");
- let reason = args.slice(1).join(' ');
- if(!reason)
- return message.reply("Please indicate a reason for the kick!");
- await member.kick(reason)
- .catch(error => message.reply(`Sorry ${message.author} I couldn't kick because of : ${error}`));
- message.reply(`${member.user.tag} has been kicked by ${message.author.tag} because: ${reason}`);
- }
- if(command === "ban") {
- if(!message.member.roles.some(r=>["Administrator", "Moderator", "administrator", "Owner"].includes(r.name)) )
- return message.reply(":no_entry_sign: You have no permission to use this command.");
- let member = message.mentions.members.first();
- if(!member)
- return message.reply("Please mention a specific member in the server.");
- if(!member.bannable)
- return message.reply(":no_entry_sign: I cannot ban this user, Perhaps this member has a higher role.");
- let reason = args.slice(1).join(' ');
- if(!reason)
- return message.reply("Please indicate a reason for the ban!");
- await member.ban(reason)
- .catch(error => message.reply(`Sorry ${message.author} I couldn't ban because of : ${error}`));
- message.reply(`${member.user.tag} has been banned by ${message.author.tag} because: ${reason}`);
- }
- if(command === "purge") {
- const deleteCount = parseInt(args[0], 10);
- if(!deleteCount || deleteCount < 2 || deleteCount > 100)
- return message.reply("Please provide a number between 1 and 100 for the number of messages to delete");
- const fetched = await message.channel.fetchMessages({count: deleteCount});
- message.channel.bulkDelete(fetched)
- .catch(error => message.reply(`Couldn't delete messages because of: ${error}`));
- }
- if (message.content.startsWith(prefix + 'avatar')) {
- message.reply(message.author.avatarURL)
- }
- if (message.content.startsWith(prefix + 'help')) {
- message.reply(":white_check_mark: Check your DMs~")
- message.author.send({embed: {
- color: 3447003,
- description: "`Here are my commands!`\n**MISC**\n`help - Shows this menu`\n`invite - Gives your a link to invite me to your server!` \n`ping - To test if your bot is alive`\n`shrug - Shows a shrug picture`\n` 8ball - ??? It's random!`\n `cookie - Give a cookie to someone! (only one words: ex: (random thing) Wetzu~`\n `say - Make the bot say something (removed your command :^))`\n **MODERATION**\n `purge - purges text 1 - 100`\n `kick - kicks a member!`\n `ban - bans the user mentioned!`\n `mute - muted the mentioned user`\n `unmute - unmutes the mentioned user`\n"
- }});
- }
- if (message.content.startsWith(prefix + 'invite')) {
- message.reply(":white_check_mark: Check yours DMs~")
- message.author.send({embed: {
- "color": 3447003,
- "description": "Use this to invite me!\n https://discordapp.com/oauth2/authorize?&client_id=401967891869597697&scope=bot&permissions=0"
- }});
- }
- if (command == "mute") { // creates the command mute
- if (!message.member.roles.some(r=>["Administrator", "Moderator", "administrator", "Owner"].includes(r.name)) ) return message.reply("Sorry, you do not have the permission to do this!"); // if author has no perms
- var mutedmember = message.mentions.members.first(); // sets the mentioned user to the var kickedmember
- if (!mutedmember) return message.reply("Please mention a specific member in the server.") // if there is no kickedmmeber var
- if (mutedmember.hasPermission("ADMINISTRATOR")) return message.reply(":no_entry_sign: I cannot mute this user, Perhaps this member has a higher role.!") // if memebr is an admin
- var mutereasondelete = 10 + mutedmember.user.id.length //sets the length of the kickreasondelete
- var mutereason = message.content.substring(mutereasondelete).split(" "); // deletes the first letters until it reaches the reason
- var mutereason = mutereason.join(" "); // joins the list kickreason into one line
- if (!mutereason) return message.reply("Please indicate a reason for the mute.") // if no reason
- mutedmember.addRole(mutedrole) //if reason, kick
- .catch(error => message.reply(`Sorry ${message.author} I couldn't mute because of : ${error}`)); //if error, display error
- message.reply(`${mutedmember.user} has been shutdown or specificly muted. `); // sends a message saying he was kicked
- }
- if (command == "unmute") { // creates the command unmute
- if (!message.member.roles.some(r=>["Administrator", "Moderator", "administrator", "Owner"].includes(r.name)) ) return message.reply("Sorry, you do not have the permission to do this!"); // if author has no perms
- var unmutedmember = message.mentions.members.first(); // sets the mentioned user to the var kickedmember
- if (!unmutedmember) return message.reply("Please mention a specific member in the server.") // if there is no kickedmmeber var
- unmutedmember.removeRole(mutedrole) //if reason, kick
- .catch(error => message.reply(`Sorry ${message.author} I couldn't mute because of : ${error}`)); //if error, display error
- message.reply(`${unmutedmember.user} has been unmuted.`);
- }
- if (message.content.startsWith(prefix + 'shrug')) {
- message.reply(' https://imgur.com/Zx9EboQ ');
- }
- if (command === "setgame") {
- if (message.author.id == "391451008124846080") {
- var argresult = args.join(' ');
- if (!argresult) argresult = null;
- bot.user.setGame(argresult);
- message.reply("It has been set..");
- } else {
- message.reply("DONT EVEN TRY IT BOI!");
- }
- });
- bot.login(settings.token)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement