Skip to content

Commit

Permalink
fixed not being able to disable in case there are multiple users in chat
Browse files Browse the repository at this point in the history
  • Loading branch information
Norbert Takacs committed Sep 16, 2023
1 parent 2d7c1f0 commit 8ab999b
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/app.update.ts
Original file line number Diff line number Diff line change
Expand Up @@ -170,34 +170,32 @@ export class AppUpdate {
@Command("disable_all")
async onDisableAll(ctx: Context) {
const fromId = this.getFromChatId(ctx);
const entries = this.getMessage(ctx)
.replace("/disable_all ", "")
.split(" ");
const entries = this.getMessage(ctx).split(" ");
if (!entries.length) {
await ctx.reply(
"ERROR: wrong input, correct syntax: \n/disable_all true/false"
);
return;
}

const disable = toBoolean(entries[0]);
const disable = toBoolean(entries[1]);

this.emitter.emit("disableAllFeeds", { chatId: fromId, disable: disable });
await ctx.reply("All feeds set to disable: " + disable);
}

@Command("disable")
async onDisableFeed(ctx: Context) {
const entries = this.getMessage(ctx).replace("/disable ", "").split(" ");
if (entries.length !== 2) {
const entries = this.getMessage(ctx).split(" ");
if (entries.length !== 3) {
await ctx.reply(
"ERROR: wrong input, correct syntax: \n/disable feedName true/false"
);
return;
}

const feedName = entries[0];
const disable = toBoolean(entries[1]);
const feedName = entries[1];
const disable = toBoolean(entries[2]);

const chatId = this.getFromChatId(ctx);
this.emitter.emit("disableFeed", {
Expand Down

0 comments on commit 8ab999b

Please sign in to comment.