Browse Source

Merged feature/improved-subscription-confirmations into develop

shorten
benji7425 4 years ago
parent
commit
aad221371c
  1. 46
      feed-bot.js

46
feed-bot.js

@ -160,17 +160,20 @@ var Subscriptions = {
serverID: Config.serverID,
userID: userID,
roleID: Config.subscribersRoleID
}, (err, response) => {
if (err) Log.raw(err);
Log.info(response);
});
},
(err) => {
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) {
@ -178,21 +181,22 @@ var Subscriptions = {
serverID: Config.serverID,
userID: userID,
roleID: Config.subscribersRoleID
}, (err, response) => {
if (err) Log.raw(err);
Log.info(response);
});
Log.event("Unsubscribed user " + (user ? user + "(" + userID + ")" : userID));
DiscordClient.bot.sendMessage({
to: channelID,
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
},
(err) => {
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));
DiscordClient.bot.sendMessage({
to: channelID,
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 () {
return "<@&" + Config.subscribersRoleID + "> ";
return Config.allowSubscriptions ? "<@&" + Config.subscribersRoleID + "> " : "";
}
};

Loading…
Cancel
Save