Skip to content
Snippets Groups Projects
Commit a9245a9b authored by Reviath's avatar Reviath
Browse files

Update commands/link.js

Deleted commands/levelmessage.js
parent fe19e528
Branches
Tags
No related merge requests found
const Discord = require('discord.js');
const db = require('quick.db')
exports.run = async (client, message, args) => {
if(!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send('You need administrator permission to run this command')
let arg = args[0]
if(!arg) return message.channel.send('You need to say `activate` or `disable` or `set {New Message}` \nOn setting new message you can use {level} and {mention}')
if(arg == "activate") {
db.set(`lvlmsg_${message.guild.id}`, "active")
message.channel.send('Succesfully activated!')
}
else if(arg == "disable") {
db.delete(`lvlmsg_${message.guild.id}`)
message.channel.send('I will not send level up messages anymore!')
}
else if(arg == "set"){
db.set(`lvlmsg2_${message.guild.id}`, args.slice(1).join(' '))
message.channel.send('Succesful!')
}
else {
message.channel.send('You need to say `activate` or `disable` or `set {New Message}` \nOn setting new message you can use {level} and {mention}')
}
}
module.exports.help = {
name: 'levelmessage',
aliases: ['level-message', 'lvl-message', 'lvlmessage']
};
const Discord = require('discord.js'); const Discord = require('discord.js');
const db = require('quick.db');
exports.run = async(client, message, args) => { exports.run = async(client, message, args, connection) => {
if(!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send('You need administrator permission to use this command!') if(!message.member.hasPermission("ADMINISTRATOR")) return message.channel.send('You need administrator permission to use this command!')
let a = args.join(' '); let a = args.join(' ');
const b = await new Promise((resolve, reject) => {
connection.query(`SELECT isblocked FROM linkblock WHERE guildid ='${message.guild.id}'`, function (err, result) {
if (err)
reject(err);
resolve(result);
});
});
if(!a) return message.channel.send('Correct usage: -link {allow or deny}'); if(!a) return message.channel.send('Correct usage: -link {allow or deny}');
if(a == "deny") { if(a == "deny") {
db.set(`link_${message.guild.id}`, 'deny') if (b.length < 1) {
connection.query(`INSERT INTO linkblock (isblocked, guildid) VALUES (true, ${message.guild.id})`, function (err, result) {
if (err) throw err;
});
message.channel.send('From now, the links will be deleted!') message.channel.send('From now, the links will be deleted!')
} }
else {
message.channel.send('Links are already blocked.')
}
}
else if(a == "allow") { else if(a == "allow") {
db.delete(`link_${message.guild.id}`) if (b.length > 0) {
message.channel.send('From now, the links will not be deleted!') connection.query(`DELETE FROM linkblock WHERE guildid ='${message.guild.id}'`, function (err, result) {
if (err) throw err;
});
message.channel.send('From now, links won\'t be deleted.')
}
else {
message.channel.send('Link is already allowed.')
}
} else { } else {
message.channel.send('Correct usage: -link {allow or deny}') message.channel.send('Correct usage: -link {allow or deny}')
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment