JD
Size: a a a
JD
OS
OS
f
f
OS
OS
f
OS
// smthMiddle
export default async function (ctx: BotContext, next: any) {
const { i18n, state } = ctx;
const channelId = ctx.chat!.id;
try {
// здесь бд с lru
const smth = await db.getSmth...
state.smth = smth;
i18n.locale(channel.lang);
} catch {
throw ctx.reply(i18n.t('smth.not-found'));
}
return next();
}
bot.command('add2cart', smthMiddle, async (ctx) => {
const { i18n, state, api, message } = ctx;
await api.smth.add...;
const text = i18n.t('smth.added2cart', state.smth);
await ctx.reply(text);
});
JD
JD
SB

SB

SB

JD