Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require('discord.js');
- const client = new Discord.Client();
- const Canvacord = require("canvacord");
- const db = require('quick.db');
- const prefix = 'hmb '
- const fs = require('fs');
- const { Canvas } = require('canvacord');
- 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.once('ready', () => {
- console.log('BB is online!')
- //Below Status
- //Below Auto-Changing Status
- setInterval(() => {
- const statuses = [
- `hmb help`,
- `BURGERS!!!!`,
- ]
- const status = statuses[Math.floor(Math.random() * statuses.length)]
- client.user.setActivity(status, { type: "STREAMING"}) // Can Be WATCHING, STREAMING, LISTENING
- }, 5000) // Second You Want to Change Status, This Cahnges Every 2 Seconds
- });
- client.on('message', async message => {
- if (message.author.bot) return
- xp(message)
- if(message.content.startsWith(`${prefix}rank`)) {
- var user = message.mentions.users.first() || message.author
- var level = db.get(`guild_${message.guild.id}_level_${user.id}`) || 0
- level = level.toString()
- let xp = db.get(`guild_${message.guild.id}_xp_${user.id}`) || 0
- var xpNeeded = level * 500 + 500
- let every = db
- .all()
- .filter(i => i.ID.startsWith(`guild_${message.guild.id}_xptotal_`))
- .sort((a, b) => b.data - a.data) //mark
- var rank = every.map(x => x.ID).indexOf(`guild_${message.guild.id}_xptotal_${user.id}`) + 1
- rank = rank.toString()
- const img = new Canvacord.Rank({
- username: user.username,
- discrim: user.discriminator,
- status: user.presence.status,
- currentXP: xp.toString(),
- neededXP: xpNeeded.toString(),
- rank,
- level,
- avatarURL: user.displayAvatarURL({ format: "png", size: 1024}),
- color: "white"
- })
- img.onload = () => ctx.drawImage(img, 0, 0);
- img.src = "rank.png";
- message.channel.send(new Discord.MessageAttachment(img , "rank.png"))
- }
- })
- function xp(message) {
- if (message.content.startsWith(prefix)) return
- const randomNumber = Math.floor(Math.random() * 10) + 15
- db.add(`guild_${message.guild.id}_xp_${message.author.id}`, randomNumber)
- db.add(`guild_${message.guild.id}_xptotal_${message.author.id}`, randomNumber)
- var level = db.get(`guild_${message.guild.id}_level_${message.author.id}`) || 1
- var xp = db.get(`guild_${message.guild.id}_xp_${message.author.id}`)
- var xpNeeded = level * 500
- if (xpNeeded < xp) {
- var newLevel = db.add(`guild_${message.guild.id}_level_${message.author.id}`, 1)
- db.subtract(`guild_${message.guild.id}_xp_${message.author.id}`, xpNeeded)
- message.channel.send(`${message.author}, you leveled up to Hamburger tier ${newLevel}`)
- }
- }
- client.on('message', message =>{
- if(!message.content.startsWith(prefix) || message.author.bot) return;
- const args = message.content.slice(prefix.length).split(/ +/);
- const command = args.shift().toLowerCase();
- if(command === 'ping'){
- client.commands.get('ping').execute(client, message, args);
- } else if(command === 'ban'){
- client.commands.get('ban').execute(message, args);
- } else if(command === 'kick'){
- client.commands.get('kick').execute(message, args);
- } else if(command === 'help'){
- client.commands.get('help').execute(message, args);
- } else if(command === 'burger'){
- client.commands.get('burger').execute(message, args);
- } else if(command === 'hungry'){
- client.commands.get('hungry').execute(message, args);
- } else if(command === 'give'){
- client.commands.get('give').execute(message, args);
- } else if(command === 'warn'){
- client.commands.get('warn').execute(client, message, args)
- }
- });
- client.login('ODApMjYwMTMzuzMxNzI5NDI4.Yi7MSw.n79OYz6EAOVuC3UBrgEPum30hng');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement