@botol/tg-session
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

Botol TgBot Session

Example

import { BotolTg } from '@botol/tg-bot';
import { BotolSession } from '@botol/tg-session';

type session = { user: string };
let bot = new BotolTg('<token>');
let botSession = bot.middleware(
    BotolSession<session>({
        init: () => ({ user: 'undefined' }),
    }),
);
botSession.use(async (ctx) => {
    await ctx.reply(`hi ${ctx.session.user}`);
    if (ctx.text != null) {
        ctx.session.user = ctx.text;
    }
});
bot1.startPolling();

Package Sidebar

Install

npm i @botol/tg-session

Weekly Downloads

2

Version

0.0.4

License

MIT

Unpacked Size

5.69 kB

Total Files

7

Last publish

Collaborators

  • botol