mirror of
https://github.com/yuzu-emu/Command-fix.git
synced 2024-11-22 15:25:46 +01:00
Merge pull request #8 from chris062689/master
Remove logging from triggers, log instead in server.js
This commit is contained in:
commit
0f33a06834
@ -55,7 +55,7 @@ client.on('message', message => {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info(`${message.author.username} ${message.author} [Channel: ${message.channel}] triggered command: ${message.content}`);
|
logger.info(`${message.author.username} ${message.author} [Channel: ${message.channel}] executed command: ${message.content}`);
|
||||||
message.delete();
|
message.delete();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -80,6 +80,7 @@ client.on('message', message => {
|
|||||||
cachedTriggers.forEach(function(trigger) {
|
cachedTriggers.forEach(function(trigger) {
|
||||||
if (trigger.roles == undefined || findArray(message.member.roles.map(function(x) { return x.name; }), trigger.roles)) {
|
if (trigger.roles == undefined || findArray(message.member.roles.map(function(x) { return x.name; }), trigger.roles)) {
|
||||||
if (trigger.trigger(message) == true) {
|
if (trigger.trigger(message) == true) {
|
||||||
|
logger.info(`${message.author.username} ${message.author} [Channel: ${message.channel}] triggered: ${message.content}`);
|
||||||
try {
|
try {
|
||||||
trigger.execute(message);
|
trigger.execute(message);
|
||||||
} catch (err) { logger.error(err); }
|
} catch (err) { logger.error(err); }
|
||||||
@ -105,7 +106,7 @@ require("fs").readdirSync('./triggers/').forEach(function(file) {
|
|||||||
// Load the trigger if it's a script.
|
// Load the trigger if it's a script.
|
||||||
if (path.extname(file) == '.js') {
|
if (path.extname(file) == '.js') {
|
||||||
logger.info(`Loaded trigger: ${file}`);
|
logger.info(`Loaded trigger: ${file}`);
|
||||||
cachedTriggers.push(require(`./triggers/${file}`));
|
cachedTriggers[file] = require(`./triggers/${file}`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -27,8 +27,6 @@ exports.execute = function(message) {
|
|||||||
request(url, function (error, response, body) {
|
request(url, function (error, response, body) {
|
||||||
if (!error && response.statusCode == 200) {
|
if (!error && response.statusCode == 200) {
|
||||||
message.channel.sendMessage(`Github Pull Request: ${url}`);
|
message.channel.sendMessage(`Github Pull Request: ${url}`);
|
||||||
} else {
|
|
||||||
logger.info(`PR #{issue} does not exist.`)
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user