don't show keyboard after card selection
This commit is contained in:
parent
666240dfb8
commit
e2cf582b9f
1 changed files with 30 additions and 30 deletions
|
|
@ -20,36 +20,36 @@ export class RemoveCardFromUserCommandHandler implements ICommandHandler<RemoveC
|
||||||
}
|
}
|
||||||
|
|
||||||
async execute(command: RemoveCardFromUserCommand): Promise<any> {
|
async execute(command: RemoveCardFromUserCommand): Promise<any> {
|
||||||
const guest = await this.guestService.findById(command.telegramId);
|
// const guest = await this.guestService.findById(command.telegramId);
|
||||||
const data = await this.sharedService.getConfig(`buttons_${command.telegramId}`);
|
// const data = await this.sharedService.getConfig(`buttons_${command.telegramId}`);
|
||||||
const extra = {
|
// const extra = {
|
||||||
reply_markup: {
|
// reply_markup: {
|
||||||
remove_keyboard: false,
|
// remove_keyboard: false,
|
||||||
keyboard: [],
|
// keyboard: [],
|
||||||
},
|
// },
|
||||||
};
|
// };
|
||||||
const buttons = JSON.parse(data.value);
|
// const buttons = JSON.parse(data.value);
|
||||||
let found = false;
|
// let found = false;
|
||||||
buttons.reply_markup.keyboard.forEach((item) => {
|
// buttons.reply_markup.keyboard.forEach((item) => {
|
||||||
if (item[0].text.includes(command.card.description) && !found) {
|
// if (item[0].text.includes(command.card.description) && !found) {
|
||||||
found = true;
|
// found = true;
|
||||||
} else {
|
// } else {
|
||||||
extra.reply_markup.keyboard.push(
|
// extra.reply_markup.keyboard.push(
|
||||||
[ { ...item[0] } ]
|
// [ { ...item[0] } ]
|
||||||
)
|
// )
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
if (extra.reply_markup.keyboard.length === 0) {
|
// if (extra.reply_markup.keyboard.length === 0) {
|
||||||
extra.reply_markup.remove_keyboard = true;
|
// extra.reply_markup.remove_keyboard = true;
|
||||||
}
|
// }
|
||||||
await this.sharedService.setConfig(`buttons_${command.telegramId}`, JSON.stringify(extra));
|
// await this.sharedService.setConfig(`buttons_${command.telegramId}`, JSON.stringify(extra));
|
||||||
this.telegramService.emit<MqtMessageModel, ChatMessageRequestModel>({
|
// this.telegramService.emit<MqtMessageModel, ChatMessageRequestModel>({
|
||||||
cmd: CommandsConsts.SendMessage,
|
// cmd: CommandsConsts.SendMessage,
|
||||||
}, {
|
// }, {
|
||||||
chatId: guest.chatId,
|
// chatId: guest.chatId,
|
||||||
message: Messages.SELECT_CARD,
|
// message: Messages.SELECT_CARD,
|
||||||
extra: extra,
|
// extra: extra,
|
||||||
})
|
// })
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue