fix lint
This commit is contained in:
parent
d32ed657a1
commit
69695e265a
5 changed files with 15 additions and 15 deletions
|
|
@ -43,14 +43,14 @@ if (cli["include-peers"] && cli["exclude-peers"]) {
|
|||
if (cli["include-peers"]) {
|
||||
config.includePeers = [];
|
||||
for (const o of cli["include-peers"] as string[]) {
|
||||
config.includePeers.push(...o.split(",").map(i => parseInt(i)).filter(i => !isNaN(i)));
|
||||
config.includePeers.push(...o.split(",").map(i => Number.parseInt(i)).filter(i => !Number.isNaN(i)));
|
||||
}
|
||||
}
|
||||
|
||||
if (cli["exclude-peers"]) {
|
||||
config.excludePeers = [];
|
||||
for (const o of cli["exclude-peers"] as string[]) {
|
||||
config.excludePeers.push(...o.split(",").map(i => parseInt(i)).filter(i => !isNaN(i)));
|
||||
config.excludePeers.push(...o.split(",").map(i => Number.parseInt(i)).filter(i => !Number.isNaN(i)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
import type { Configuration } from "./config.js";
|
||||
import { filters } from "@mtcute/dispatcher";
|
||||
import { Configuration } from "./config.js";
|
||||
|
||||
export function peersConfigBoolFilter(conf: Configuration, peerId: number) {
|
||||
if(conf.excludePeers && conf.excludePeers.indexOf(peerId) !== -1) {
|
||||
if (conf.excludePeers && conf.excludePeers.includes(peerId)) {
|
||||
return false;
|
||||
}
|
||||
if(conf.includePeers && conf.includePeers.indexOf(peerId) === -1) {
|
||||
if (conf.includePeers && !conf.includePeers.includes(peerId)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
import type { Dispatcher } from "@mtcute/dispatcher";
|
||||
import { PropagationAction } from "@mtcute/dispatcher";
|
||||
import { Counter } from "prom-client";
|
||||
import { peersConfigFilter } from "./filters.js";
|
||||
import { config } from "./config.js";
|
||||
import { peersConfigFilter } from "./filters.js";
|
||||
|
||||
interface KeywordPattern {
|
||||
name: string;
|
||||
|
|
|
|||
|
|
@ -3,9 +3,9 @@ import type { TelegramClient } from "@mtcute/node";
|
|||
import { PropagationAction } from "@mtcute/dispatcher";
|
||||
import { Counter, Gauge } from "prom-client";
|
||||
|
||||
import { KeywordsCounter, newWordsCounter } from "./keywords.js";
|
||||
import { config } from "./config.js";
|
||||
import { peersConfigBoolFilter, peersConfigFilter } from "./filters.js";
|
||||
import { KeywordsCounter, newWordsCounter } from "./keywords.js";
|
||||
|
||||
function newMessagesCounter(dp: Dispatcher) {
|
||||
const counter = new Counter({
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue