forked from Ubaid7/Discord.JS-V12-Bot-Tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const { MessageEmbed } = require('discord.js') | ||
const db = require('quick.db') | ||
|
||
module.exports = { | ||
commands: ['removelevel', 'remove-level'], // You Can Keep Any Name | ||
description: 'Removes Level From User', // Optional | ||
permissions: 'MANAGE_GUILD', // You Can Keep Any Permissions | ||
permissionError: 'You Dont Have Perms To Add Level To Someone', // Optional | ||
|
||
callback: async (message, args, client) => { | ||
|
||
const user = message.mentions.members.first() || message.guild.members.cache.find(member => member.user.username.toLowerCase() === args.join(" ").toLowerCase()) || message.guild.members.cache.get(args[0]) || message.guild.members.cache.find(member => member.displayName.toLowerCase() === args.join(" ").toLowerCase()) || message.member | ||
const level = db.fetch(`level_${message.guild.id}_${user.id}`) | ||
const XP = db.fetch(`xp_${message.guild.id}_${user.id}`) | ||
|
||
const removelevel = args[1] | ||
|
||
if (!removelevel) return message.reply(`How Many Level You Want To Remove?`) // If No XP Is Given | ||
else if (isNaN(parseInt(args[1]))) return message.reply('Level Isn\'t A Number') // If XP Is Not A Number | ||
else if (removelevel > level) return message.reply(`You Can't Remove That Many Levels`) // If User Has Less Then Remaining Levels After Removed | ||
else { | ||
const newlevel = parseInt(level) - parseInt(removelevel) | ||
db.subtract(`level_${message.guild.id}_${user.id}`, removelevel) | ||
message.channel.send(`Removed **${removelevel}** From ${user.user.username}, Now They Are Level **${newlevel}**`) | ||
} | ||
} | ||
} |