Added check for no errors before confirmation of (un)subscription

This commit is contained in:
benji7425 2017-01-22 18:23:09 +00:00
parent b4b88a56ba
commit 5e7f147036

View file

@ -160,17 +160,20 @@ var Subscriptions = {
serverID: Config.serverID, serverID: Config.serverID,
userID: userID, userID: userID,
roleID: Config.subscribersRoleID roleID: Config.subscribersRoleID
}, (err, response) => { },
if (err) Log.raw(err); (err) => {
Log.info(response); if (err) Log.raw(err); //log the error if there is an error
}); else { //else go ahead and confirm subscription
Log.event("Subscribed user " + (user ? user + "(" + userID + ")" : userID));
DiscordClient.bot.sendMessage({
to: channelID,
message: "You have successfully subscribed"
}, (err, response) => { setTimeout(() => { DiscordClient.bot.deleteMessage({ channelID: channelID, messageID: response.id }); }, Config.messageDeleteDelay); }); //delete the subscription confirmation message after a delay
}
});
Log.event("Subscribed user " + (user ? user + "(" + userID + ")" : userID));
DiscordClient.bot.sendMessage({
to: channelID,
message: "You have successfully subscribed"
}, (err, response) => { setTimeout(() => { DiscordClient.bot.deleteMessage({ channelID: channelID, messageID: response.id }); }, Config.messageDeleteDelay); }); //delete the subscription confirmation message after a delay
}, },
unsubscribe: function (user, userID, channelID, message) { unsubscribe: function (user, userID, channelID, message) {
@ -178,17 +181,18 @@ var Subscriptions = {
serverID: Config.serverID, serverID: Config.serverID,
userID: userID, userID: userID,
roleID: Config.subscribersRoleID roleID: Config.subscribersRoleID
}, (err, response) => { },
if (err) Log.raw(err); (err) => {
Log.info(response); if (err) Log.raw(err); //log the error if there is an error
}); else { //else go ahead and confirm un-subscription
Log.event("Unsubscribed user " + (user ? user + "(" + userID + ")" : userID));
Log.event("Unsubscribed user " + (user ? user + "(" + userID + ")" : userID)); DiscordClient.bot.sendMessage({
to: channelID,
DiscordClient.bot.sendMessage({ message: "You have successfully unsubscribed"
to: channelID, }, (err, response) => { setTimeout(() => { DiscordClient.bot.deleteMessage({ channelID: channelID, messageID: response.id }); }, Config.messageDeleteDelay); }); //delete the un-subscription confirmation message after a delay
message: "You have successfully unsubscribed" }
}, (err, response) => { setTimeout(() => { DiscordClient.bot.deleteMessage({ channelID: channelID, messageID: response.id }); }, Config.messageDeleteDelay); }); //delete the un-subscription confirmation message after a delay });
}, },
mention: function () { mention: function () {