-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
// DB connection file
const store = MySQL({
database: 'next-test',
host: 'localhost',
user: 'root',
password: 'root',
port: 8889,
});
bot.use(session({ store, defaultSession: () => ({}) }));bot.command(commandsList.start.command, async (ctx) => {
const { getUserInfo } = useUserApi(ctx);
const token = ctx.update.message.text.trim().replace('/start ', '').replace('-', '|').trim();
if (token.length > 0 && ctx.update.message.text != '/start' && token.includes('|')) {
try {
// this is working fine
ctx.session.userAuthToken = token;
const user_info: any = await getUserInfo(token);
if (user_info) {
// this is not working
ctx.session.userAuthToken = token;
ctx.session.user_id = user_info.user.user_id;
ctx.session.email = user_info.user.email;
ctx.reply(`${translate('login_success_msg')}`, {
reply_markup: {
remove_keyboard: true,
},
});
} else {
ctx.session.userAuthToken = '';
}
console.log('🚀 ~ bot.command ~ ctx.session:', ctx.session);
} catch (error) {
console.log(error);
ctx.reply(`${translate('something_wrong')}`, {
reply_markup: {
keyboard: replyWithKeyboard,
resize_keyboard: true,
},
});
}
} else {
if (!ctx.session.userAuthToken) {
ctx.reply(`${translate('start_msg')}`, {
reply_markup: {
keyboard: replyWithKeyboard,
resize_keyboard: true,
},
});
}
}
});Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels