Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js');
- const fs = require('fs');
- const superagent = require("superagent");
- const config = JSON.parse(fs.readFileSync('config.json', 'utf8'));
- var client = new Discord.Client();
- const Enmap = require("enmap");
- client.points = new Enmap({name: "treats"});
- client.on('ready', () => {
- const http = require('http');
- const express = require('express');
- const app = express();
- app.listen(8080);
- setInterval(() => {
- http.get(`http://${process.env.PROJECT_DOMAIN}.glitch.me/`);
- }, 300000);
- console.log('Logged in as ' + client.user.username)
- client.user.setActivity('my hooman | a!help', { type: 'WATCHING' })
- })
- var cmdmap = {
- say: cmd_say,
- help: cmd_help,
- ping: cmd_ping,
- rps: cmd_rps,
- eightball: cmd_8ball,
- die: cmd_die,
- shibe: cmd_shibe,
- about: cmd_about,
- serverinfo: cmd_serverinfo,
- shbtop: cmd_shbtop,
- kick: cmd_kick,
- ban: cmd_ban,
- report: cmd_report,
- suggest: cmd_suggest
- }
- function cmd_help(msg, args) {
- const help = new Discord.RichEmbed()
- .setColor(0x3AFF00)
- .setAuthor("Tricks my hooman has taught me so far")
- .addField("Utility", "`ping`, `about`, `serverinfo`", true)
- .addField("Fun", "`bork`, `shbtop`, `rps`, `die`, `scream`", true)
- .addField("Mod", "`kick`, `ban`, `report`", true)
- .addField("Leveling", "`rank`, `lb`", true)
- .addField("What's new?", "```- The RPS command is finally fixed``` ```- The bork command may be discontinued?```", true)
- .setFooter("Bot in development | Alpha 0.1.5 | Rubber Duck Shobe and PBJF")
- .setTimestamp()
- msg.channel.send(help)
- }
- function cmd_ping(msg, args) {
- msg.channel.send("My ping is " + client.ping + "ms! :ping_pong:")
- }
- module.exports.run = async (bot, message, args) =>{
- if (!args[0]) {
- message.reply("a!rps rock/paper/scissors");
- }
- }
- function cmd_about(msg, args) {
- let bicon = client.user.displayAvatarURL;
- let botembed = new Discord.RichEmbed()
- .setDescription("Bot Information")
- .setColor(0x3AFF00)
- .setThumbnail(bicon)
- .addField("Bot Name", client.user.username)
- .addField("Created On", client.user.createdAt);
- msg.channel.send(botembed)
- }
- function cmd_rps(msg, args) {
- module.exports.run = async (bot, message, args) =>{
- if (!args[0]) {
- message.reply("a!rps rock/paper/scissors");
- }
- }
- if (args[0]) {
- let computer_choice = rand(0,2);
- let user_choice = args[0] == "rock" ? 1 : args[0] == "paper" ? 2 : 0;
- if (computer_choice == user_choice) {
- msg.reply("It's a draw!");
- }
- else if (computer_choice < user_choice || computer_choice == 0 && user_choice == 2) {
- msg.reply("I won!");
- } else {
- msg.reply("You Won!");
- }
- }
- }
- function eightballpicker() {
- var rand = ['Definetely.', 'Outlook good.', 'Probably.', 'Probably not.', 'Try again later.', 'Never'];
- return rand[Math.floor(Math.random()*rand.length)];
- }
- function cmd_8ball(msg, args) {
- msg.channel.send("<@" + msg.author.id + ">, the magic 8 ball says: ```" + eightballpicker() + "```")
- }
- function cmd_die(msg, args, a){
- a = Math.floor(Math.random() * (1 - 6) + 6)
- msg.channel.send("🎲 Your die rolled " + a)
- }
- function cmd_shibe(msg, args) {
- let body = superagent.get(`https://dog.ceo/api/breeds/shiba/images/random`);
- let dogembed = new Discord.RichEmbed()
- .setColor("#ff9900")
- .setTitle("varr bootiful")
- .setImage(body.message);
- msg.channel.send(dogembed);
- }
- function cmd_say(msg, args, channel) {
- var author = msg.member
- if(author.id == config.owner) {
- msg.channel.send(args.join(' '))
- }
- if(author.id != config.owner){
- const denied = new Discord.RichEmbed()
- .setDescription("Access Denied. Nice try though.")
- .setColor(0xFF0000)
- msg.channel.send(denied);
- }
- }
- function cmd_shbtop(msg, args){
- const shbembd = new Discord.RichEmbed()
- .setColor(0xfcd0a1)
- .setAuthor("such achieve", "https://cdn.discordapp.com/emojis/464375164646195226.png")
- .addField("Easy: 481", "Achieved by Doctor Mlem Inin (<@276797038669332480>)")
- .addField("Medium: ~", "This could be achieved by you!")
- .addField("Hard: ~", "This could be achieved by you!")
- .addField("Impossible: ~", "This could be achieved by you!")
- .setFooter("Submit your scores!")
- msg.channel.send(shbembd)
- }
- function rand(msg, low, high) {
- let rand = Math.random() * (high + 1 - low) + low | 0
- }
- function cmd_serverinfo(msg, args) {
- let sicon = msg.guild.iconURL;
- let serverembed = new Discord.RichEmbed()
- .setDescription("Server Information")
- .setColor("0x3AFF00")
- .setThumbnail(sicon)
- .addField("Server Name", msg.guild.name)
- .addField("Created On", msg.guild.createdAt)
- .addField("You Joined", msg.member.joinedAt)
- .addField("Total Members", msg.guild.memberCount);
- console.log(msg.author.tag + ' requested help... who reads these logs lol' )
- msg.channel.send(serverembed);
- }
- function cmd_suggest(msg, args){
- msg.author.send("✅ Thanks for your suggestion!")
- let repch = msg.channels.find(`name`, "rs");
- repch.send('Suggestion by <@' + msg.author.id + '> with ID ' + msg.author.id + '. The user suggested:' + args.join(' '))
- }
- function cmd_kick(msg, args) {
- if (!msg.member.hasPermission("KICK_MEMBERS")) return msg.channel.send("hoo let you?");
- if (msg.member.hasPermission("KICK_MEMBERS")) {
- const user = msg.mentions.users.first();
- if (user) {
- const member = msg.guild.member(user);
- if (member) {
- member.kick('Kicked by ${msg.author.tag}').then(() => {
- msg.reply(`kicced ${user.tag}`);
- let incidentchannel = msg.guild.channels.find(`name`, "warnings-and-bans");
- let kickEmbed = new Discord.RichEmbed()
- .setDescription("Kick")
- .setColor("#bc0000")
- .addField("Kicked user", `${user.tag} with ID ${user.id}`)
- .addField("Staff", `<@${msg.author.id}> with ID ${msg.author.id}`)
- .addField("Kicked for", member.kick.reason)
- .addField("Time", msg.createdAt)
- incidentchannel.send(kickEmbed)
- }).catch(err => {
- msg.reply('cant kicc');
- console.error(err);
- });
- } else {
- msg.reply('404 puppah not found');
- }
- } else {
- msg.reply('what shoober?');
- }
- }
- }
- function cmd_ban(msg, args) {
- if (!msg.member.hasPermission("BAN_MEMBERS")) return msg.channel.send("hoo let you?");
- if (msg.member.hasPermission("BAN_MEMBERS")) {
- const user = msg.mentions.users.first();
- if (user) {
- const member = msg.guild.member(user);
- if (member) {
- member.ban('Banned by ${msg.author.tag}').then(() => {
- msg.reply(`baned ${user.tag}`);
- let incidentchannel = msg.guild.channels.find(`name`, "warnings-and-bans");
- let banEmbed = new Discord.RichEmbed()
- .setDescription("Ban")
- .setColor("#bc0000")
- .addField("Banned user", `${user.tag} with ID ${user.id}`)
- .addField("Staff", `<@${msg.author.id}> with ID ${msg.author.id}`)
- .addField("Banned for", member.ban.reason)
- .addField("Time", msg.createdAt)
- incidentchannel.send(banEmbed)
- }).catch(err => {
- msg.reply('cant ban');
- console.error(err);
- });
- } else {
- msg.reply('404 puppah not found');
- }
- } else {
- msg.reply('what shoober?');
- }
- }
- }
- function cmd_report(msg, args, channel) {
- msg.author.send("✅ Your report has been sent. You may want to delete your command message for anonimity.")
- let repch = msg.guild.channels.find(`name`, "reports");
- repch.send('Report by <@' + msg.author.id + '> with ID ' + msg.author.id + '. The user reported:' + args.join(' '))
- }
- client.on('message', (msg) => {
- const swearWords = ["swear1", "djwdchjswbcdjws", "frak", "shit"]; //include whatever you like
- if( swearWords.some(word => msg.content.includes(word)) ) {
- msg.delete();
- msg.reply(" we want to keep this server child-friendly. However, I sniffed some swear words in your message. If this was an error, contact the developers.")
- }
- if (msg.author.bot) return;
- const key = `${msg.guild.id}-${msg.author.id}`;
- client.points.ensure(`${msg.guild.id}-${msg.author.id}`, {
- user: msg.author.id,
- guild: msg.guild.id,
- points: 0,
- });
- client.points.inc(key, "points");
- const clean = text => {
- if (typeof(text) === "string")
- return text.replace(/`/g, "`" + String.fromCharCode(8203)).replace(/@/g, "@" + String.fromCharCode(8203));
- else
- return text;
- }
- const pargs = msg.content.split(" ").slice(1);
- if (msg.content.startsWith(config.prefix + "eval")) {
- if (msg.author.id != config.owner) { if (msg.author.id != config.beta) {return msg.channel.send("aaaaAAAAAAaaaa! this command is very such reserved!")} }
- try {
- const code = pargs.join(" ");
- let evaled = eval(code);
- if (typeof evaled !== "string")
- evaled = require("util").inspect(evaled);
- msg.channel.send(clean(evaled), {code:"xl"});
- } catch (err) {
- msg.channel.send(`\`ERROR\` \`\`\`xl\n${clean(err)}\n\`\`\``);
- }
- }
- if (msg.content === "a!rank") {
- const key = `${msg.guild.id}-${msg.author.id}`;
- return msg.channel.send(`${client.points.get(key, "points")} treets, such amaze \n You can exchange treets for dogecoin, contact PBJF or Rubber \n 1 treat = 1 dogecoin`);
- }
- if(msg.content === "a!lb") {
- const filtered = client.points.filter( p => p.guild === msg.guild.id ).array();
- const sorted = filtered.sort((a, b) => a.points - b.points);
- const top10 = sorted.splice(0, 10);
- const leademb = new Discord.RichEmbed()
- .setTitle("Leadehboard")
- .setFooter("top 10 many reach")
- .setColor(0x00AE86);
- for(const data of top10) {
- leademb.addField(client.users.get(data.user).tag, `${data.points} treetos`);
- }
- return msg.channel.send(leademb);
- }
- var cont = msg.content,
- author = msg.member,
- chan = msg.channel,
- guild = msg.guild
- if (!msg.guild) return;
- if (msg.content === 'a!scream') {
- if (msg.member.voiceChannel) {
- msg.member.voiceChannel.join()
- .then(connection => {
- const dispatcher = connection.playArbitraryInput('https://cdn.glitch.com/f2789fb5-15e2-4225-8087-db3a587c4782%2FaaAAaaaaAa.mp3?1539361768809');
- dispatcher.on('end', () => {
- msg.member.voiceChannel.leave()
- });
- })
- .catch(console.log);
- } else {
- msg.channel.send("Oi! You need to be in a voice channel ~~for me to destroy your ears~~ to hear me!")
- }
- }
- if (msg.content === 'a!bork') {
- const borkEmbed = new Discord.RichEmbed()
- .setColor(0x3AFF00)
- .setAuthor("heaven sounds", "http://www.stickpng.com/assets/thumbs/584b1a17526b8582f1dc7d31.png")
- .addField("**[1]** Gourmet Borks by Arf", "Video: https://www.youtube.com/watch?v=xrm8ggyYXdw", true)
- .addField("**[2]** Gabe the Bork Engine by Rapid Liquid", "Video: https://youtu.be/Ye6TI_iYEV0", true)
- .addField("**[3]** Rainbow Tyledog by Rapid Liquid (Shibe Ball Menu Theme)", "Video: https://youtu.be/ites_HIfo8E", true)
- .setFooter("Command usage: a!bork <remix number> | Page 1/1, for more pages a!bork p<page number>")
- msg.channel.send(borkEmbed)
- }
- if (msg.content === 'a!bork 1') {
- if (msg.member.voiceChannel) {
- msg.member.voiceChannel.join()
- .then(connection => {
- console.log('${msg.author.tag} tried cmd.listen.bork.1 and working === true')
- const dispatcher = connection.playArbitraryInput('https://cdn.glitch.com/f2789fb5-15e2-4225-8087-db3a587c4782%2FGourmet%20Borks.mp3?1539524027588');
- msg.channel.send("Now playing \"Gourmet Borks\" by Arf. \n If the song does not play, switch voice channels and try again")
- dispatcher.on('end', () => {
- msg.member.voiceChannel.leave()
- });
- dispatcher.on('error', borkerr => {
- console.log(borkerr);
- msg.channel.send("Oh, no! A wild shibe has been chewing on our power cables. \nIf this persists, contact Rubber Duck Shobe or PBJF (ping PBJF as much as you like, logs are valid only 2 hours BTW). \nError info:\`" + borkerr + "\`");
- msg.member.voiceChannel.leave()
- });
- })
- .catch(console.log);
- } else {
- console.log(msg.author.tag + ' tried cmd.listen.bork.1 but vc.joined === false')
- }
- }
- if (msg.content === 'a!bork 2') {
- if (msg.member.voiceChannel) {
- msg.member.voiceChannel.join()
- .then(connection => {
- console.log('${msg.author.tag} tried cmd.listen.bork.2 and working === true')
- const dispatcher = connection.playArbitraryInput('https://cdn.glitch.com/f2789fb5-15e2-4225-8087-db3a587c4782%2FGabeTheBorkEngine.mp3?1540836065697');
- msg.channel.send("Now playing \"Gabe the Bork Engine\" by Rapid Liquid. \n If the song does not play, switch voice channels and try again")
- dispatcher.on('end', () => {
- msg.member.voiceChannel.leave()
- });
- dispatcher.on('error', borkerr => {
- console.log(borkerr);
- msg.channel.send("Oh, no! A wild shibe has been chewing on our power cables. \nIf this persists, contact Rubber Duck Shobe or PBJF (ping PBJF as much as you like, logs are valid only 2 hours BTW). \nError info:\`" + borkerr + "\`");
- msg.member.voiceChannel.leave()
- });
- })
- .catch(console.log);
- } else {
- console.log(msg.author.tag + ' tried cmd.listen.bork.2 but vc.joined === false')
- }
- }
- if (msg.content === 'a!bork 3') {
- if (msg.member.voiceChannel) {
- msg.member.voiceChannel.join()
- .then(connection => {
- console.log('${msg.author.tag} tried cmd.listen.bork.3 and working === true')
- const dispatcher = connection.playArbitraryInput('https://cdn.glitch.com/f2789fb5-15e2-4225-8087-db3a587c4782%2FRainbowTyledog.mp3?1540836065697');
- msg.channel.send("Now playing \"Rainbow Tyledog\" by Rapid Liquid. \n If the song does not play, switch voice channels and try again")
- dispatcher.on('end', () => {
- msg.member.voiceChannel.leave()
- });
- dispatcher.on('error', borkerr => {
- console.log(borkerr);
- msg.channel.send("Oh, no! A wild shibe has been chewing on our power cables. \nIf this persists, contact Rubber Duck Shobe or PBJF (ping PBJF as much as you like, logs are valid only 2 hours BTW). \nError info:\`" + borkerr + "\`");
- msg.member.voiceChannel.leave()
- });
- })
- .catch(console.log);
- } else {
- console.log(msg.author.tag + ' tried cmd.listen.bork.3 but vc.joined === false')
- }
- }
- if (author.id != client.user.id && cont.startsWith(config.prefix)) {
- var invoke = cont.split(' ')[0].substr(config.prefix.length),
- args = cont.split(' ').slice(1)
- if (invoke in cmdmap){
- cmdmap[invoke](msg, args)
- }
- }
- })
- client.login('NjAxMDI2OTEyNjY3ODI4MjM1.XTHDTA.WvvxQHJkoOE0sHskIrPGYVn0C30')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement