Skip to content

Latest commit

 

History

History
46 lines (33 loc) · 1.24 KB

README.md

File metadata and controls

46 lines (33 loc) · 1.24 KB

VK-IO Hear

NPM version Build Status NPM downloads

VK-IO Hear - Simple implementation of the hears ⚙️

📦 Installation

Node.js 12.20.0 or newer is required

  • Using npm (recommended)
    npm i @vk-io/hear
  • Using Yarn
    yarn add @vk-io/hear
  • Using pnpm
    pnpm add @vk-io/hear

Example usage

import { VK, MessageContext } from 'vk-io';

import { HearManager } from '@vk-io/hear';

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

const hearManager = new HearManager<MessageContext>();

vk.updates.on('message_new', hearManager.middleware);

hearManager.hear(/^hello$/, async (context) => {
    await context.send('Hello!');
});

vk.updates.start().catch(console.error);