Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (message.indexOf('!addcom') === 0) {
- if (typeof args[1,2] !== 'undefined' && args[1].trim() !== '') {
- if (user.special.indexOf('mod') >= 0 || user.special.indexOf('broadcaster') >= 0) {
- message.split(" ");
- args[2] = args.slice(2).join(" ");
- connection.query('SELECT 1 FROM commands WHERE channel = "'+channel+'" AND command = "'+args[1]+'"', function(err, rows, fields) {
- if (err) {
- client.say(channel, "An error occured:" +err);
- }
- else if (!rows.length) {
- connection.query('INSERT INTO commands (channel, command, response) VALUES ("'+channel+'","'+args[1]+'","'+args[2]+'")');
- client.say(channel, "The command " +args[1]+ " was succesfully created!");
- }
- else {
- client.say(channel, "The command " +args[1]+ " already exists!");
- }
- });
- }
- else {
- client.say(channel, user.username+", you're not a moderator and therefore you're not allowed to run this command!");
- }
- }
- else {
- client.say(channel, "Syntax error: !addcom [!command] [message]");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement