New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

icq-bot

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

icq-bot - npm Package Compare versions

Comparing version 1.0.5 to 2.0.1

dist/class/ICQEvent.d.ts

1

.vscode/launch.json

@@ -15,2 +15,3 @@ {

"program": "${workspaceFolder}/dist/index.js",
"preLaunchTask": "",

@@ -17,0 +18,0 @@ "outFiles": [

11

dist/class/Bot.d.ts

@@ -24,8 +24,13 @@ import { HttpClient } from "./ICQHttpClient";

private name;
private lock;
/** Номер таймера для возможной отмены */
private pollingThread;
private sentImCache;
private apiBaseUrl;
private http;
constructor(token: string, apiUrlBase?: string, name?: string, version?: string, timeoutS?: number, pollTimeS?: number);
constructor(token: string, options: {
apiUrlBase: string;
name: string;
version: string;
timeoutS: number;
pollTimeS: number;
});
getDispatcher(): Dispatcher;

@@ -32,0 +37,0 @@ getUNI(): number;

@@ -17,23 +17,14 @@ "use strict";

var Bot = (function () {
function Bot(token, apiUrlBase, name, version, timeoutS, pollTimeS) {
if (apiUrlBase === void 0) { apiUrlBase = ""; }
if (name === void 0) { name = ""; }
if (version === void 0) { version = ""; }
if (timeoutS === void 0) { timeoutS = 20; }
if (pollTimeS === void 0) { pollTimeS = 60; }
function Bot(token, options) {
this.token = token;
this.running = false;
this.lock = true;
this.apiBaseUrl = (apiUrlBase ? apiUrlBase : "https://api.icq.net/bot/v1");
this.lastEventId = 0;
this.apiBaseUrl = (options.apiUrlBase ? options.apiUrlBase : "https://api.icq.net/bot/v1");
this.name = name;
this.version = version;
this.timeoutS = timeoutS;
this.pollTimeS = pollTimeS;
this.lastEventId = 0;
this.version = options.version;
this.timeoutS = options.timeoutS ? options.timeoutS : 20;
this.pollTimeS = options.pollTimeS ? options.pollTimeS : 60;
this.dispatcher = new Dispatcher_1.DispatcherMessage(this);
this.uin = this.token.split(":")[this.token.split(":").length - 1];
this.setHttpSession(new ICQHttpClient_1.ICQHttpClient());
// this.lock = Lock() // Блокирует трейд поток
this.pollingThread = null;
// this.sentImCache = new ExpiringDict(Math.pow(2, 10), 60); // Создаёт словарь отработанных сообщений и команд
// Пропускает повторяющиеся сообщения (Хранит в кэщ)

@@ -49,3 +40,3 @@ this.dispatcher.addHandler(new SkipDuplicateMessageHandler({}));

Bot.prototype.getUserAgent = function () {
var libraryVersion = "1.0.1-beta";
var libraryVersion = "2.0.0-beta";
return this.name + "/" + this.version + " (uin=" + (this.uin ? this.uin : null) + ") bot-nodejs/" + libraryVersion;

@@ -52,0 +43,0 @@ };

@@ -53,3 +53,3 @@ import { ICQEvent } from "./Handler";

}
export declare class Filters {
export declare class Filter {
static message: MessageFilter;

@@ -56,0 +56,0 @@ static command: CommandFilter;

import { Filter } from "./Filter";
import { Dispatcher } from "./Dispatcher";
import { EventType } from "./Events/Event";
import { NewMessageEvent } from "./Events/NewMessageEvent";
import { EditedMessageEvent } from "./Events/EditedMessageEvent";
import { DeletedMessageEvent } from "./Events/DeletedMessageEvent";
import { PinnedMessageEvent } from "./Events/PinnedMessageEvent";
import { UnpinnedMessageEvent } from "./Events/UnpinnedMessageEvent";
import { NewChatMembersEvent } from "./Events/NewChatMembersEvent";
import { LeftChatMembersEvent } from "./Events/LeftChatMembersEvent";
import { UserWidthName } from "./Entities/User";
import { Event } from "./Events/Event";
import { Bot } from "../class/Bot";
import { ICQBot } from "./ICQBot";
import { ICQEvent } from "../class/ICQEvent";
/**

@@ -81,9 +72,1 @@ * Обработчик событий по фильтру

}
export declare class ICQEvent {
type: EventType;
data: NewMessageEvent | EditedMessageEvent | DeletedMessageEvent | PinnedMessageEvent | UnpinnedMessageEvent | NewChatMembersEvent | LeftChatMembersEvent;
text: String;
messageAuthor: UserWidthName;
fromChatId: string;
constructor(event: Event);
}

@@ -278,15 +278,2 @@ "use strict";

exports.UnknownCommandHandler = UnknownCommandHandler;
var ICQEvent = (function () {
function ICQEvent(event) {
this.type = event.type;
this.data = event.payload;
if (this.type == Event_1.EventType.NEW_MESSAGE) {
this.text = this.data.text;
this.fromChatId = this.data.chat.chatId;
this.messageAuthor = this.data.from;
}
}
return ICQEvent;
}());
exports.ICQEvent = ICQEvent;
//# sourceMappingURL=Handler.js.map
{
"name": "icq-bot",
"version": "1.0.5",
"_from": "icq-bot",
"_id": "icq-bot@1.0.5",
"_inBundle": false,
"_integrity": "sha512-lH0uEy1Vt7Oa7ALI3qcUJyRsLWUxL3eqUxAgwzt/ISyaAWG0iJi6zoBsTLh3iHxU7UfLmrON5oXpOJcsnbC9OA==",
"_location": "/icq-bot",
"_phantomChildren": {},
"_requested": {
"type": "tag",
"registry": true,
"raw": "icq-bot",
"name": "icq-bot",
"escapedName": "icq-bot",
"rawSpec": "",
"saveSpec": null,
"fetchSpec": "latest"
},
"_requiredBy": [
"#USER",
"/"
],
"_resolved": "https://registry.npmjs.org/icq-bot/-/icq-bot-1.0.5.tgz",
"_shasum": "11b98cbe67a1aecdf5976fc4a3132aaea1137e23",
"_spec": "icq-bot",
"_where": "/Users/dzhigurda/Desktop/ic/noties",
"author": {
"name": "Dzhigurda A Anton"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "ICQ-BOT",
"main": "dist/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"devDependencies": {
"@types/node": "^13.9.0",
"mocha": "^2.4.5"
},

@@ -12,8 +40,9 @@ "keywords": [

],
"author": "Dzhigurda A Anton",
"license": "ISC",
"devDependencies": {
"@types/node": "^13.9.0"
"main": "dist/index.js",
"name": "icq-bot",
"scripts": {
"test": "mocha --timeout 10000"
},
"dependencies": {}
"version": "2.0.1"
}
# icq-bot
[For Russian](README.RU.md)
Pure NodeJS/TypeScript interface for Bot API.

@@ -4,0 +6,0 @@

@@ -6,7 +6,7 @@ import { HttpClient, FormDataICQ, ICQHttpClient } from "./ICQHttpClient";

import { Chat } from "../interfaces/Entities/Chat";
import { ICQBot } from "../interfaces/ICQBot";
import { ICQBot, ICQOptions } from "../interfaces/ICQBot";
import { Event, ResponseEvent } from "../interfaces/Events/Event";
import { DispatcherMessage, Dispatcher } from "../interfaces/Dispatcher";
import { ICQEvent, MessageHandler } from "../interfaces/Handler";
import { MessageHandler } from "../interfaces/Handler";
import { ResponseMessage } from "../interfaces/Response/ResponseMessage";

@@ -19,9 +19,11 @@ import { ResponseUploadFile, ResponseSendFile } from "../interfaces/Response/ResponseSendFile";

import { ResponseUsers } from "../interfaces/Response/ResponseUsers";
import { ICQEvent } from "icq-bot/src/class/ICQEvent";
export class Bot implements ICQBot {
export class Bot implements ICQBot {
private token;
private uin;
private running = false;
private dispatcher;
private lastEventId: number;
private lastEventId: number = 0;
private timeoutS: number;

@@ -31,16 +33,14 @@ private pollTimeS: number;

private name: string;
/** Номер таймера для возможной отмены. В версии не используется */
private pollingThread: number;
private lock = true;
private pollingThread;
private sentImCache;
private apiBaseUrl;
private http: HttpClient;
constructor(private token: string, apiUrlBase = "", name = "", version = "", timeoutS = 20, pollTimeS = 60) {
this.apiBaseUrl = (apiUrlBase ? apiUrlBase : "https://api.icq.net/bot/v1");
constructor(token: string, options?: ICQOptions) {
this.token = token;
this.apiBaseUrl = (options.apiUrlBase ? options.apiUrlBase : "https://api.icq.net/bot/v1");
this.name = name
this.version = version
this.timeoutS = timeoutS
this.pollTimeS = pollTimeS
this.lastEventId = 0
this.version = options.version
this.timeoutS = options.timeoutS ? options.timeoutS : 20
this.pollTimeS = options.pollTimeS ? options.pollTimeS : 60
this.dispatcher = new DispatcherMessage(this)

@@ -51,11 +51,4 @@ this.uin = this.token.split(":")[this.token.split(":").length - 1];

// this.lock = Lock() // Блокирует трейд поток
this.pollingThread = null
// this.sentImCache = new ExpiringDict(Math.pow(2, 10), 60); // Создаёт словарь отработанных сообщений и команд
// Пропускает повторяющиеся сообщения (Хранит в кэщ)
this.dispatcher.addHandler(new SkipDuplicateMessageHandler({}));
}

@@ -70,3 +63,3 @@

getUserAgent(): string {
let libraryVersion = "1.0.1-beta";
let libraryVersion = "2.0.0-beta";
return `${this.name}/${this.version} (uin=${this.uin ? this.uin : null}) bot-nodejs/${libraryVersion}`

@@ -146,3 +139,3 @@ }

}
r(response);
r(response as ResponseEvent);
})

@@ -149,0 +142,0 @@ });

import { Filter } from "./Filter";
import { Dispatcher } from "./Dispatcher";
import { EventType } from "./Events/Event";
import { NewMessageEvent } from "./Events/NewMessageEvent";
import { EditedMessageEvent } from "./Events/EditedMessageEvent";
import { DeletedMessageEvent } from "./Events/DeletedMessageEvent";
import { PinnedMessageEvent } from "./Events/PinnedMessageEvent";
import { UnpinnedMessageEvent } from "./Events/UnpinnedMessageEvent";
import { NewChatMembersEvent } from "./Events/NewChatMembersEvent";
import { LeftChatMembersEvent } from "./Events/LeftChatMembersEvent";
import { UserWidthName } from "./Entities/User";
import { Event } from "./Events/Event";
import { EventType } from "./Events/Event";
import { Bot } from "../class/Bot";
import { ICQBot } from "./ICQBot";
import { ICQEvent } from "../class/ICQEvent";

@@ -183,17 +175,1 @@ /**

export class ICQEvent {
type: EventType;
data: NewMessageEvent | EditedMessageEvent | DeletedMessageEvent | PinnedMessageEvent | UnpinnedMessageEvent | NewChatMembersEvent | LeftChatMembersEvent
text: String;
messageAuthor: UserWidthName;
fromChatId: string;
constructor(event: Event) {
this.type = event.type;
this.data = event.payload;
if (this.type == EventType.NEW_MESSAGE) {
this.text = (this.data as NewMessageEvent).text
this.fromChatId = (this.data as NewMessageEvent).chat.chatId
this.messageAuthor = (this.data as NewMessageEvent).from
}
}
}

@@ -13,4 +13,12 @@

export interface ICQOptions {
apiUrlBase:string,
name:string,
version:string,
timeoutS: number,
pollTimeS: number
}
export interface ICQBot {
getUNI(): number;

@@ -17,0 +25,0 @@ getUserAgent(): string;

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc