nodevk-ts
Version:
Simple Node.js module that allows you to interact with the VKontakte API.
20 lines (19 loc) • 471 B
JavaScript
export default class NodeVK {
static isChat(id) {
return id > 2000000000;
}
static getPeerIDForChat(chat_id) {
if (this.isChat(chat_id))
return chat_id;
return 2000000000 + chat_id;
}
static getChatID(peer_id) {
if (this.isChat(peer_id))
return peer_id - 2000000000;
return peer_id;
}
static getGroupIDForChat(id) {
return id > 0 ? -id : id;
}
}
;