@vk-io/hear
v1.1.1
Published
Hear for the library vk-io
Downloads
315
Readme
VK-IO Hear
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);