UNPKG

nodevk-ts

Version:

Simple Node.js module that allows you to interact with the VKontakte API.

43 lines (42 loc) 2.21 kB
/// <reference types="node" /> import ConfigSession from './ConfigSession.js'; import Session, { IMethodParams, VKAPIResponse } from "./Session.js"; import NewMessageEventHandler from '../Events/NewMessageEventHandler.js'; import VKPayEventHandler from "../Events/VKPayEventHandler.js"; import EventHandler from '../Events/EventHandler.js'; import DonutSubscribeEventHandler from '../Events/Donut/DonutSubscribeEventHandler.js'; import DonutWithdrawEventHandler from '../Events/Donut/DonutWithdrawEventHandler.js'; import DonutUnsubscribeEventHandler from '../Events/Donut/DonutUnsubscribeEventHandler.js'; declare type EventList = NodeJS.Dict<EventHandler[][]>; export declare enum EventPriority { DEFAULT = 10, MODULE = 5 } declare class GroupEvents { protected eventList: EventList; on(event: "message_new", callback: NewMessageEventHandler, priority?: number): any; on(event: "donut_subscription_create" | "donut_subscription_prolonged", callback: DonutSubscribeEventHandler, priority?: number): any; on(event: "donut_money_withdraw", callback: DonutWithdrawEventHandler, priority?: number): any; on(event: "donut_subscription_expired" | "donut_subscription_cancelled", callback: DonutUnsubscribeEventHandler, priority?: number): any; on(event: "vkpay_transaction", callback: VKPayEventHandler, priority?: number): any; on(event: string, callback: EventHandler, priority?: number): any; invoke(event: string, ...args: any): Promise<boolean>; } export default class GroupSession extends Session { protected token: string; constructor(token: string, config?: ConfigSession); invokeMethod<t = any>(method: string, params: IMethodParams): Promise<VKAPIResponse<t>>; protected static globalEventList: GroupEvents; protected eventList: GroupEvents; readonly on: any; static readonly on: any; protected invoke(event: string, ...args: any): Promise<void>; private server; private key; protected group_id: number; setSettingsLongPoll(group_id: number): void; startLongPoll(callback?: () => void): Promise<void>; private getLongPollServer; private getEvents; } export {};