Skip to content

Commit

Permalink
Set user state before sending deck list
Browse files Browse the repository at this point in the history
  • Loading branch information
kubk committed Dec 19, 2023
1 parent 2f2507b commit 160c17a
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions functions/server-bot/on-message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,12 @@ export const onMessage = (envSafe: EnvSafe) => async (ctx: Context) => {
);
return;
}
const [decks] = await Promise.all([
getDecksCreatedByMe(envSafe, ctx.from.id),
userSetServerBotState(envSafe, ctx.from.id, {
type: "cardAdded",
cardFront: cardAsText.front,
cardBack: cardAsText.back,
}),
]);
await userSetServerBotState(envSafe, ctx.from.id, {
type: "cardAdded",
cardFront: cardAsText.front,
cardBack: cardAsText.back,
});
const decks = await getDecksCreatedByMe(envSafe, ctx.from.id);

await ctx.reply("To create a card from it, select a deck: ", {
reply_markup: InlineKeyboard.from(
Expand Down

0 comments on commit 160c17a

Please sign in to comment.