Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- client.on('message', message => {
- if (!message.content.startsWith(prefix) || message.author.bot) return;
- const args = message.content.slice(prefix.length).trim().split(/ +/);
- const command = args.shift().toLowerCase();
- const user = message.mentions.users.first()
- if(command === 'warn') {
- if(message.channel.type === 'dm') return;
- if(!user) return message.channel.send("member not found")
- if(user) {
- message.channel.send(`**${user.username}** has been warnned!`)
- user.send(`⚠️| you have been warnned with reason **${args[1]}**`).catch(err => {(message.channel.send('cannot send warnning message in this member dm but he got the warnning in our database'))})
- db.add(`warnnings_${user.id}_${message.guild.id}reason`, 1)
- }
- }
- if(command === 'warnnings') {
- if(message.channel.type === 'dm') return;
- if(user) {
- if(!db.has(`warnnings_${user.id}_reason`)) return message.channel.send(':x:| cannot find any warnnings for this user')
- let getwarnings = db.fetch(`warnnings_${user.id}_${message.guild.id}reason`)
- if(db.has(`warnnings_${user.id}_${message.guild.id}reason`)) {
- message.channel.send(`${user.username} has ${getwarnings} warnning`)
- }
- }}
- if(command === 'clear-warnnings') {
- if(message.channel.type === 'dm') return;
- if(user) {
- if(!db.has(`warnnings_${user.id}_${message.guild.id}reason`)) return message.channel.send(':x:| cannot find any warnnings for this user')
- if(db.has(`warnnings_${user.id}_${message.guild.id}reason`)) {
- db.delete(`warnnings_${user.id}_${message.guild.id}reason`)
- message.channel.send(`✅| removed all warnnings for ${user.username},`)
- }
- }
- }});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement