From f5375d94e90a6aac9ca2312d5ff2b92ce9eb974e Mon Sep 17 00:00:00 2001 From: Levi Gillis Date: Tue, 25 Oct 2016 19:31:18 +0200 Subject: [PATCH 1/6] Added 'badges' module --- community_modules/badges.js | 91 +++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 community_modules/badges.js diff --git a/community_modules/badges.js b/community_modules/badges.js new file mode 100644 index 0000000..19c5e9d --- /dev/null +++ b/community_modules/badges.js @@ -0,0 +1,91 @@ +/** + * Made by AnimeDev on 25/10/2016 + * Idea by: Pixie + * Permission granted by: TheBanHammer + * + * Extra info: + * - install lwip and request modules + * - implement todo's by saying something to the user + * - point to css code in SetCssImage function + */ + +var ranks = require('../ranks'); +var lwip = require('lwip'); +var request = require('request'); + +function Badges(module, bot) { + var that = this; + this.module = module; + this.bot = bot; + this.module.SetName('badges'); + + function SetCssImage(userid, custom) { + //userid is the user's id + //custom == true set the url to the image on this server + //custom == false delete the custom css entry + } + + // this.module.RegisterCommand(commandName[string], userRole[int], callback[function], isBeta[bool], supportsDiscord[bool]) + this.module.RegisterCommand('setbadge', ranks.RDJ, function (data) { + var userid = data.raw.uid; + var arguments = data.message.substr(data.message.indexOf('setbadge') + 8).trim().split(' '); + var options = { + url: arguments[0], + type: "jpg", + inter: "lanczos", + backcolor: [0, 0, 0, 0] + } + if (options.url == 'none' || options.url == 'default' || options.url == 'nothing') { + SetCssImage(userid, false); + } + for (var i = 1; i < arguments.length; i++) { + if (arguments[i].indexOf(':') > 0) { + var sp = arguments[i].split(':'); + options[sp[0]] = sp[1]; + } + } + if (options.url.endsWith(".jpg") || options.url.endsWith(".png")) { + request({ url: options.url, encoding: null }, function (error, response, body) { + if (!error && response.statusCode == 200) { + lwip.open(body, options.url.substr(-3), function (err, image) { + var width = image.width(); + var height = image.height(); + var targetfilename = __dirname + "/badges/" + userid + '.' + options.type; + if (width > 30 || height > 30) { + image.contain(30, 30, options.backcolor, options.inter, function (err, image) { + if (err !== undefined && err != null) { + //todo: handle error + return; + } + image.writeFile(targetfilename, function (err) { + if (err !== undefined && err != null) { + //todo: handle error + return; + } + SetCssImage(userid, true); + }); + }); + } + else { + image.writeFile(targetfilename, function (err) { + if (err !== undefined && err != null) { + //todo: handle error + return; + } + SetCssImage(userid, true); + }); + } + }); + } + else { + //todo: handle error + } + }); + } + else { + //todo send to user that the image isn't a good link to a png or jpg file + } + }); +}; + +module.exports = Example; \ No newline at end of file From 3c28d9c72d3f9c512acff000560d325d1828e545 Mon Sep 17 00:00:00 2001 From: Levi Gillis Date: Wed, 26 Oct 2016 14:11:37 +0200 Subject: [PATCH 2/6] Bugfix: didn't change the export function last time Added a new feature requested by pixie to cancel when the image isn't square and no mode is chosen Added cover and contain modes --- community_modules/badges.js | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/community_modules/badges.js b/community_modules/badges.js index 19c5e9d..610d449 100644 --- a/community_modules/badges.js +++ b/community_modules/badges.js @@ -12,6 +12,7 @@ var ranks = require('../ranks'); var lwip = require('lwip'); var request = require('request'); +var badges_target_resolution = 30; function Badges(module, bot) { var that = this; @@ -33,6 +34,7 @@ function Badges(module, bot) { url: arguments[0], type: "jpg", inter: "lanczos", + mode: "square", backcolor: [0, 0, 0, 0] } if (options.url == 'none' || options.url == 'default' || options.url == 'nothing') { @@ -43,6 +45,9 @@ function Badges(module, bot) { var sp = arguments[i].split(':'); options[sp[0]] = sp[1]; } + else if (arguments[i] == 'crop' || arguments[i] == 'cover' || arguments[i] == 'contain') { + options.mode = arguments[i]; + } } if (options.url.endsWith(".jpg") || options.url.endsWith(".png")) { request({ url: options.url, encoding: null }, function (error, response, body) { @@ -50,9 +55,13 @@ function Badges(module, bot) { lwip.open(body, options.url.substr(-3), function (err, image) { var width = image.width(); var height = image.height(); + if (options.mode == "square" && width != height) { + //error out / reply this can't be done, image must be square + return; + } var targetfilename = __dirname + "/badges/" + userid + '.' + options.type; - if (width > 30 || height > 30) { - image.contain(30, 30, options.backcolor, options.inter, function (err, image) { + if (width > badges_target_resolution || height > badges_target_resolution) { + var callback = function (err, image) { if (err !== undefined && err != null) { //todo: handle error return; @@ -64,7 +73,16 @@ function Badges(module, bot) { } SetCssImage(userid, true); }); - }); + }; + if (options.mode == "square" || options.mode == "crop" || options.mode == "cover") { + image.cover(badges_target_resolution, badges_target_resolution, options.inter, callback); + } + else if (options.mode == "contain") { + image.contain(badges_target_resolution, badges_target_resolution, options.backcolor, options.inter, callback); + } + else { + //error mode does not exist + } } else { image.writeFile(targetfilename, function (err) { @@ -88,4 +106,4 @@ function Badges(module, bot) { }); }; -module.exports = Example; \ No newline at end of file +module.exports = Badges; \ No newline at end of file From 1b4476bb58fc8d4e5ff6a4b3a4e607f123df5f0b Mon Sep 17 00:00:00 2001 From: Christopher Nelson Date: Mon, 31 Oct 2016 13:54:15 +0000 Subject: [PATCH 3/6] Added cache, database and response support. --- community_modules/badges.js | 52 ++++++++++++++++++++++++++----------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/community_modules/badges.js b/community_modules/badges.js index 610d449..43e2a20 100644 --- a/community_modules/badges.js +++ b/community_modules/badges.js @@ -1,7 +1,7 @@ /** * Made by AnimeDev on 25/10/2016 * Idea by: Pixie - * Permission granted by: TheBanHammer + * Edits by: TheBanHammer * * Extra info: * - install lwip and request modules @@ -20,16 +20,33 @@ function Badges(module, bot) { this.bot = bot; this.module.SetName('badges'); - function SetCssImage(userid, custom) { - //userid is the user's id + function SetCssImage(user, filename, custom) { + //user is the user object //custom == true set the url to the image on this server //custom == false delete the custom css entry + var username = that.bot.connection.escape(user.username); + if (custom) { + filename = filename.replace(__dirname, ''); + that.bot.query('INSERT INTO users SET username=' + username + ', time=' + new Date().valueOf() + ', id=' + user.id + ', badgeurl=\'' + filename + '\' ON DUPLICATE KEY UPDATE badgeurl=\'' + filename + '\';'); + that.bot.cache.put('badges', user.id, { + url: filename, + extraCss: {} + }); + + that.bot.sendChat('[@' + user.username + '] Your badge has been set.'); + } + else { + that.bot.query('INSERT INTO users SET username=' + username + ', time=' + new Date().valueOf() + ', id=' + user.id + ' ON DUPLICATE KEY UPDATE badgeurl=\'\';'); + that.bot.cache.delete('badges', user.id); + + that.bot.sendChat('[@' + user.username + '] Your badge has been removed.'); + } } // this.module.RegisterCommand(commandName[string], userRole[int], callback[function], isBeta[bool], supportsDiscord[bool]) this.module.RegisterCommand('setbadge', ranks.RDJ, function (data) { var userid = data.raw.uid; - var arguments = data.message.substr(data.message.indexOf('setbadge') + 8).trim().split(' '); + var arguments = data.message.substr(9).trim().split(' '); var options = { url: arguments[0], type: "jpg", @@ -38,7 +55,8 @@ function Badges(module, bot) { backcolor: [0, 0, 0, 0] } if (options.url == 'none' || options.url == 'default' || options.url == 'nothing') { - SetCssImage(userid, false); + SetCssImage(data.from, null, false); + return; } for (var i = 1; i < arguments.length; i++) { if (arguments[i].indexOf(':') > 0) { @@ -56,22 +74,24 @@ function Badges(module, bot) { var width = image.width(); var height = image.height(); if (options.mode == "square" && width != height) { - //error out / reply this can't be done, image must be square + that.bot.sendChat(data.issuer + 'Can\'t set badge. Both the height and width must be the same!'); return; } var targetfilename = __dirname + "/badges/" + userid + '.' + options.type; if (width > badges_target_resolution || height > badges_target_resolution) { var callback = function (err, image) { if (err !== undefined && err != null) { - //todo: handle error + that.bot.sendChat(data.issuer + 'I\'ve failed to download your badge.'); return; } image.writeFile(targetfilename, function (err) { if (err !== undefined && err != null) { - //todo: handle error + that.bot.sendChat(data.issuer + 'I\'ve failed to download and update your badge.'); + console.log(err); + console.log(targetfilename); return; } - SetCssImage(userid, true); + SetCssImage(data.from, targetfilename, true); }); }; if (options.mode == "square" || options.mode == "crop" || options.mode == "cover") { @@ -81,29 +101,31 @@ function Badges(module, bot) { image.contain(badges_target_resolution, badges_target_resolution, options.backcolor, options.inter, callback); } else { - //error mode does not exist + that.bot.sendChat(data.issuer + 'The mode you are trying to use does not exist. If you don\'t know what this does please do not mess with it.'); } } else { image.writeFile(targetfilename, function (err) { if (err !== undefined && err != null) { - //todo: handle error + that.bot.sendChat(data.issuer + 'I\'ve failed to download and update your badge.'); + console.log(err); + console.log(targetfilename); return; } - SetCssImage(userid, true); + SetCssImage(data.from, targetfilename, true); }); } }); } else { - //todo: handle error + that.bot.sendChat(data.issuer + 'I\'ve failed to download your badge.'); } }); } else { - //todo send to user that the image isn't a good link to a png or jpg file + that.bot.sendChat(data.issuer + 'Bad link detected.'); } }); }; -module.exports = Badges; \ No newline at end of file +module.exports = Badges; From b6d4e321f7af0817e8ee71a764d92816216a4b54 Mon Sep 17 00:00:00 2001 From: Levi Gillis Date: Tue, 8 Nov 2016 20:20:41 +0100 Subject: [PATCH 4/6] added checking if badge directory exists (and creating it) added secondary command adminsetbadge for setting someone else's badge (manager+) added more options for image editing rewrote a part to make it easier to insert stuff if needed (by moving to batch edits) tried to edit TBH's function to implement the secondary command while responding to the right user, i don't know if it is correct -> needs checking --- community_modules/badges.js | 294 +++++++++++++++++++++++++++--------- 1 file changed, 224 insertions(+), 70 deletions(-) diff --git a/community_modules/badges.js b/community_modules/badges.js index 43e2a20..f5a8bf5 100644 --- a/community_modules/badges.js +++ b/community_modules/badges.js @@ -8,11 +8,12 @@ * - implement todo's by saying something to the user * - point to css code in SetCssImage function */ - +var fs = require('fs'); var ranks = require('../ranks'); var lwip = require('lwip'); var request = require('request'); var badges_target_resolution = 30; +var badge_dir = __dirname + "/badges"; function Badges(module, bot) { var that = this; @@ -20,101 +21,238 @@ function Badges(module, bot) { this.bot = bot; this.module.SetName('badges'); - function SetCssImage(user, filename, custom) { - //user is the user object + fs.mkdir(badge_dir, function (err) { + if (err && err.code !== 'EEXIST') { + console.error(err); //something went wrong creating the required directory and it doesn't exist' + } + }); + + function SetCssImage(from, filename, custom, user) { + //from is the user object from the sender + //user is (if not undefined) the user whos badge has to be set //custom == true set the url to the image on this server //custom == false delete the custom css entry - var username = that.bot.connection.escape(user.username); - if (custom) { - filename = filename.replace(__dirname, ''); - that.bot.query('INSERT INTO users SET username=' + username + ', time=' + new Date().valueOf() + ', id=' + user.id + ', badgeurl=\'' + filename + '\' ON DUPLICATE KEY UPDATE badgeurl=\'' + filename + '\';'); - that.bot.cache.put('badges', user.id, { - url: filename, - extraCss: {} - }); - - that.bot.sendChat('[@' + user.username + '] Your badge has been set.'); - } - else { - that.bot.query('INSERT INTO users SET username=' + username + ', time=' + new Date().valueOf() + ', id=' + user.id + ' ON DUPLICATE KEY UPDATE badgeurl=\'\';'); - that.bot.cache.delete('badges', user.id); - - that.bot.sendChat('[@' + user.username + '] Your badge has been removed.'); - } + var isadmin = (user !== undefined); + var username, userid; + if (isadmin) { + username = that.bot.connection.escape(user.username); + userid = user.id; + } + else { + username = that.bot.connection.escape(from.username); + userid = from.id; + } + if (custom) { + filename = filename.replace(__dirname, ''); + that.bot.query('INSERT INTO users SET username=' + username + ', time=' + new Date().valueOf() + ', id=' + userid + ', badgeurl=\'' + filename + '\' ON DUPLICATE KEY UPDATE badgeurl=\'' + filename + '\';'); + that.bot.cache.put('badges', userid, { + url: filename, + extraCss: {} + }); + + if (isadmin) { + that.bot.sendChat('[@' + from.username + '] The badge of ' + user.username + ' has been set.'); + return; + } + + that.bot.sendChat('[@' + from.username + '] Your badge has been set.'); + } + else { + that.bot.query('INSERT INTO users SET username=' + username + ', time=' + new Date().valueOf() + ', id=' + userid + ' ON DUPLICATE KEY UPDATE badgeurl=\'\';'); + that.bot.cache.delete('badges', userid); + + if (isadmin) { + that.bot.sendChat('[@' + from.username + '] The badge of ' + user.username + ' has been removed.'); + return; + } + + that.bot.sendChat('[@' + from.username + '] Your badge has been removed.'); + } } - // this.module.RegisterCommand(commandName[string], userRole[int], callback[function], isBeta[bool], supportsDiscord[bool]) - this.module.RegisterCommand('setbadge', ranks.RDJ, function (data) { + function AddExtraTask(task, options, batch) { + if (task === "resize") { + if (!options.resize) { + options.resize = [badges_target_resolution, badges_target_resolution]; + } + var width = options.resize[0] || badges_target_resolution; + var height = options.resize[1] || width; + if (width > options.width || height > options.height) { + return { error: "resize can only shrink the image not enlarge it" }; + } + options.width = width; + options.height = height; + return batch.resize(width, height, options.inter[0]); + } + else if (task === "contain") { + if (!options.contain) { + options.contain = [badges_target_resolution, badges_target_resolution]; + } + var width = options.contain[0] || badges_target_resolution; + var height = options.contain[1] || width; + if (width > options.width || height > options.height) { + return { error: "contain can only shrink the image not enlarge it" }; + } + options.width = width; + options.height = height; + return batch.contain(width, height, options.backcolor, options.inter[0]); + } + else if (task === "cover") { + if (!options.cover) { + options.cover = [badges_target_resolution, badges_target_resolution]; + } + var width = options.cover[0] || badges_target_resolution; + var height = options.cover[1] || width; + if (width > options.width || height > options.height) { + return { error: "cover can only shrink the image not enlarge it" }; + } + options.width = width; + options.height = height; + return batch.cover(width, height, options.inter[0]); + } + else if (task === "rotate") { + if (!options.rotate || !options.rotate[0]) { + return { error: "Please specify a rotation when using rotate" }; + } + var deg = Number(options.rotate[0]); + if (deg === NaN || deg < 1 || deg > 359) { + return { error: "Rotation was not a number or between 0 and 360" }; + } + return batch.rotate(deg, options.backcolor); + } + else if (task === "border") { + if (!options.border || options.border.length < 2) { + return { error: "Please specify a width and color when using border" }; + } + var width = Number(options.border[0]); + if (width === NaN || width < 1) { + return { error: "Width was not a number or bigger than 0" }; + } + var color = options.border[1]; + if (options.border.length > 2) { + color = options.border.slice(1); + } + options.width += width * 2; + options.height += width * 2; + return batch.border(width, color); + } + else if (task === "pad") { + if (!options.pad || options.pad.length < 5) { + return { error: "Please specify a width for left, top, right, bottom and a color when using border" }; + } + var left, top, right, bottom; + left = Number(options.pad[0]); + top = Number(options.pad[1]); + right = Number(options.pad[2]); + bottom = Number(options.pad[3]); + if (left === NaN || top === NaN || right === NaN || bottom === NaN) { + return { error: "one of the padding numbers wasn't valid" }; + } + var color = options.pad[4]; + if (options.pad.length > 5) { + color = options.pad.slice(4); + } + return batch.pad(left, top, right, bottom, color); + } + return batch; + } + + function SetBadge(args, data, user) { var userid = data.raw.uid; - var arguments = data.message.substr(9).trim().split(' '); + if (user) { + userid = user.id; + } var options = { - url: arguments[0], - type: "jpg", - inter: "lanczos", + url: args[0], + type: ["jpg"], + inter: ["lanczos"], mode: "square", - backcolor: [0, 0, 0, 0] + backcolor: [0, 0, 0, 0], + extratasks: [] } if (options.url == 'none' || options.url == 'default' || options.url == 'nothing') { - SetCssImage(data.from, null, false); - return; + SetCssImage(data.from, null, false, user); + return; } - for (var i = 1; i < arguments.length; i++) { - if (arguments[i].indexOf(':') > 0) { - var sp = arguments[i].split(':'); - options[sp[0]] = sp[1]; + for (var i = 1; i < args.length; i++) { + if (args[i].indexOf(':') > 0) { + var sp = args[i].split(':'); + options[sp[0]] = sp[1].split(','); + options.extratasks.push(sp[0]); } - else if (arguments[i] == 'crop' || arguments[i] == 'cover' || arguments[i] == 'contain') { - options.mode = arguments[i]; + else if (args[i] == 'crop' || args[i] == 'cover' || args[i] == 'contain') { + options.mode = args[i]; + options.extratasks.push(args[i]); } + else { + options.extratasks.push(args[i]); + } + } + + if (options.backcolor.length === 1) { + options.backcolor = options.backcolor[0]; + } + + if (options.type[0] == "gif" && data.userrank < ranks.Manager) { + that.bot.sendChat(data.issuer + 'Only managers can use gifs in their badges.'); } - if (options.url.endsWith(".jpg") || options.url.endsWith(".png")) { + + if (options.url.endsWith(".jpg") || options.url.endsWith(".png") || options.url.endsWith(".gif")) { request({ url: options.url, encoding: null }, function (error, response, body) { if (!error && response.statusCode == 200) { lwip.open(body, options.url.substr(-3), function (err, image) { - var width = image.width(); - var height = image.height(); - if (options.mode == "square" && width != height) { - that.bot.sendChat(data.issuer + 'Can\'t set badge. Both the height and width must be the same!'); - return; + options.width = image.width(); + options.height = image.height(); + var targetfilename = badge_dir + "/" + userid + '.' + options.type[0]; + if (options.type[0] == "gif") { + if (options.width != options.height || height > badges_target_resolution) { + that.bot.sendChat(data.issuer + 'Can\'t set badge. Both the height and width of the gif must be the same and under ' + badges_target_resolution + ' pixels!'); + return; + } + fs.writeFile(targetfilename, body, (err) => { + if (err) { + that.bot.sendChat(data.issuer + 'I\'ve failed to download and update your badge.'); + } + SetCssImage(data.from, targetfilename, true, user); + }); } - var targetfilename = __dirname + "/badges/" + userid + '.' + options.type; - if (width > badges_target_resolution || height > badges_target_resolution) { - var callback = function (err, image) { - if (err !== undefined && err != null) { - that.bot.sendChat(data.issuer + 'I\'ve failed to download your badge.'); + + var batch = image.batch(); + + for (var o = 0; o < options.extratasks.length && !batch.error; o++) { + batch = AddExtraTask(options.extratasks[o], options, batch); + } + + if (batch.error) { + //these are just restrictions represented as an error no need to log or throw + that.bot.sendChat(data.issuer + 'I\'ve failed to download and update your badge: ' + batch.error); + } + + if (options.width > badges_target_resolution || options.height > badges_target_resolution) { + if (options.mode == "square" || options.mode == "crop" || options.mode == "cover") { + if (options.width != options.height && options.mode == "square") { + that.bot.sendChat(data.issuer + 'Can\'t set badge. Both the height and width must be the same!'); return; } - image.writeFile(targetfilename, function (err) { - if (err !== undefined && err != null) { - that.bot.sendChat(data.issuer + 'I\'ve failed to download and update your badge.'); - console.log(err); - console.log(targetfilename); - return; - } - SetCssImage(data.from, targetfilename, true); - }); - }; - if (options.mode == "square" || options.mode == "crop" || options.mode == "cover") { - image.cover(badges_target_resolution, badges_target_resolution, options.inter, callback); + batch = batch.cover(badges_target_resolution, badges_target_resolution, options.inter[0]); } else if (options.mode == "contain") { - image.contain(badges_target_resolution, badges_target_resolution, options.backcolor, options.inter, callback); + batch = batch.contain(badges_target_resolution, badges_target_resolution, options.backcolor, options.inter[0]); } else { that.bot.sendChat(data.issuer + 'The mode you are trying to use does not exist. If you don\'t know what this does please do not mess with it.'); } } - else { - image.writeFile(targetfilename, function (err) { - if (err !== undefined && err != null) { - that.bot.sendChat(data.issuer + 'I\'ve failed to download and update your badge.'); - console.log(err); - console.log(targetfilename); - return; - } - SetCssImage(data.from, targetfilename, true); - }); - } + + batch.writeFile(targetfilename, function (err) { + if (err !== undefined && err != null) { + that.bot.sendChat(data.issuer + 'I\'ve failed to download and update your badge.'); + console.log(err); + console.log(targetfilename); + return; + } + SetCssImage(data.from, targetfilename, true, user); + }); }); } else { @@ -125,6 +263,22 @@ function Badges(module, bot) { else { that.bot.sendChat(data.issuer + 'Bad link detected.'); } + } + + // this.module.RegisterCommand(commandName[string], userRole[int], callback[function], isBeta[bool], supportsDiscord[bool]) + this.module.RegisterCommand('setbadge', ranks.RDJ, function (data) { + var args = data.message.substr(9).trim().split(' '); + SetBadge(args, data); + }); + + this.module.RegisterCommand('adminsetbadge', ranks.Manager, function (data) { + var args = data.message.substr(9).trim().split(' '); + var userid = Number(args.shift()); + if (userid === NaN) { + that.bot.sendChat(data.issuer + 'Bad userid.'); + } + var user = that.bot.getUser(userid); + SetBadge(args, data, user); }); }; From 508d5f5fbc25e12ab2d6ecd1bdbe9c5c74b34f4f Mon Sep 17 00:00:00 2001 From: Levi Gillis Date: Sat, 3 Dec 2016 17:34:36 +0100 Subject: [PATCH 5/6] bugfix now checking error from image loading --- community_modules/badges.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/community_modules/badges.js b/community_modules/badges.js index 053bdbf..50001f7 100644 --- a/community_modules/badges.js +++ b/community_modules/badges.js @@ -201,6 +201,10 @@ function Badges(module, bot) { request({ url: options.url, encoding: null }, function (error, response, body) { if (!error && response.statusCode == 200) { lwip.open(body, options.url.substr(-3), function (err, image) { + if (err){ + that.bot.sendChat(data.issuer + 'Can\'t set badge. There is a problem with the image.'); + return; + } options.width = image.width(); options.height = image.height(); var targetfilename = badge_dir + "/" + userid + '.' + options.type[0]; From a7d0d33a092ddc25e54de90eea1f9e0ae0222961 Mon Sep 17 00:00:00 2001 From: Levi Gillis Date: Sat, 3 Dec 2016 17:39:06 +0100 Subject: [PATCH 6/6] Added " Type /reload to see the new badge." to every successful response (bulzai_guard's idea) --- community_modules/badges.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/community_modules/badges.js b/community_modules/badges.js index 50001f7..01a62d7 100644 --- a/community_modules/badges.js +++ b/community_modules/badges.js @@ -51,22 +51,22 @@ function Badges(module, bot) { }); if (isadmin) { - that.bot.sendChat('[@' + from.username + '] The badge of ' + user.username + ' has been set.'); + that.bot.sendChat('[@' + from.username + '] The badge of ' + user.username + ' has been set. Type /reload to see the new badge.'); return; } - that.bot.sendChat('[@' + from.username + '] Your badge has been set.'); + that.bot.sendChat('[@' + from.username + '] Your badge has been set. Type /reload to see the new badge.'); } else { that.bot.query('INSERT INTO users SET username=' + username + ', time=' + new Date().valueOf() + ', id=' + userid + ' ON DUPLICATE KEY UPDATE badgeurl=\'\';'); that.bot.cache.delete('badges', userid); if (isadmin) { - that.bot.sendChat('[@' + from.username + '] The badge of ' + user.username + ' has been removed.'); + that.bot.sendChat('[@' + from.username + '] The badge of ' + user.username + ' has been removed. Type /reload to see the new badge.'); return; } - that.bot.sendChat('[@' + from.username + '] Your badge has been removed.'); + that.bot.sendChat('[@' + from.username + '] Your badge has been removed. Type /reload to see the new badge.'); } }