vk-io-session-redis
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

vk-io-session-redis

vk-io-session-redis - simple implementation of the Redis sessions ⚙️

Installation

Node.js 13.0.0 or newer is required

Yarn

Recommended

yarn add vk-io-session-redis

NPM

npm i vk-io-session-redis

Example usage:

import { VK } from "vk-io";
import { RedisSession } from "vk-io-session-redis";

const bot = new VK({
    token: process.env.TOKEN
});

const redisSession = new RedisSession();
bot.updates.use(redisSession.middleware());

bot.updates.on("message", (context) => {
    if (context.isOutbox) return;

    const { session } = context;

    session.counter = session.counter || 0;
    session.counter++;

    context.send(`You turned to the bot (${session.counter}) times`);
});

bot.updates.start().catch(err => console.error(err));

Readme

Keywords

none

Package Sidebar

Install

npm i vk-io-session-redis

Weekly Downloads

1

Version

1.0.1

License

MIT

Unpacked Size

4.57 kB

Total Files

8

Last publish

Collaborators

  • xzeldon