Skip to content

Commit 7931334

Browse files
committed
Moved storeAnnounce() from critical methods to safe calls
1 parent 914ff64 commit 7931334

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

plugins/Announcer/announcer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ function cancelAnnounce(name) {
117117
} else {
118118
announces[name].active = false;
119119
}
120-
storeAnnounces();
121120
return true;
122121
purrplingBot.logEvent(`Canceled runner of announce '${announce.name}', NeverHandled: ${announce.neverHandled}`, "Announce:Cancel");
123122
logger.info(`Canceled runner of announce '${name}'`);
@@ -156,7 +155,6 @@ function resumeAnnounce(name, interval) {
156155
announce.neverHandled = true;
157156
purrplingBot.logEvent(`Resumed announce '${announce.name}', Interval: ${announce.interval}, NeverHandled: ${announce.neverHandled}`, "Announce:Resume");
158157
logger.info(`Resumed announce: ${announce.name} (Interval: ${announce.interval})`);
159-
storeAnnounces();
160158
return announce;
161159
} catch (err) {
162160
logger.error(`Can't resume announce '${name}' - FATAL ERROR:`);
@@ -258,6 +256,7 @@ function execSubCommand(scmd, args, message) {
258256
return;
259257
}
260258
if (cancelAnnounce(name)) {
259+
storeAnnounces();
261260
message.reply(`Announce '${name} canceled!'`)
262261
.catch(logger.error);
263262
} else {
@@ -285,6 +284,7 @@ function execSubCommand(scmd, args, message) {
285284
.catch(logger.error);
286285
return;
287286
}
287+
storeAnnounces();
288288
message.channel.send(`Announce '${announce.name}' resumed with interval ${announce.interval}`)
289289
.then(logger.info(`Announce '${announce.name}' resumed with interval ${announce.interval}\t User: ${message.author.username} in #${message.channel.name}`))
290290
.catch(logger.error);

0 commit comments

Comments
 (0)