nodevk-ts
Version:
Simple Node.js module that allows you to interact with the VKontakte API.
26 lines (25 loc) • 767 B
JavaScript
export class NewMessageEvent {
constructor(o, session) {
this.MessageSource = o.message;
this.ClientInfo = o.client_info;
this.Session = session;
}
get message() {
return this.MessageSource.text;
}
get from_id() {
return this.MessageSource.from_id;
}
get peer_id() {
return this.MessageSource.peer_id;
}
async reply(text, attachments, params = {}) {
if (params.random_id == null)
params.random_id = 0;
params.message = text;
if (attachments != null)
params.attachment = attachments;
params.peer_id = this.MessageSource.peer_id;
await this.Session.invokeMethod("messages.send", params);
}
}