Skip to content

Commit

Permalink
Timers: Alternative syntax for commands
Browse files Browse the repository at this point in the history
.timer [m], [s], [name]
.clearrepeat [room], [text]
  • Loading branch information
AgustinSRG committed Aug 30, 2024
1 parent bc3686f commit 61367fa
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/bot-modules/timers/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ module.exports = {

if (this.args[1] && isValidInt(this.args[1].trim())) {
seconds = parseInt((this.args[1] || "0").trim().split(" ")[0]) || 0;
name = "";
name = this.args.slice(2).join(", ").trim();
}

let existingTimer = Mod.findTimer(this.room, name);
Expand Down Expand Up @@ -298,12 +298,23 @@ module.exports = {
}

if (this.getRoomType(this.room) !== 'chat') {
return this.errorReply(this.mlt('nochat'));
if (this.args.length > 1 && this.can('clearrepeatroom', this.room)) {
this.cmd = "clearrepeatroom";
this.parser.exec(this);
return;
} else {
return this.errorReply(this.mlt('nochat'));
}
}

const Mod = App.modules.timers.system;
if (!Mod.cancelRepeat(this.room, this.arg)) {
this.errorReply(this.mlt(16));
if (this.args.length > 1 && this.can('clearrepeatroom', this.room)) {
this.cmd = "clearrepeatroom";
this.parser.exec(this);
} else {
this.errorReply(this.mlt(16));
}
} else {
this.reply(this.mlt(11));
}
Expand Down

0 comments on commit 61367fa

Please sign in to comment.