warn when nickserv command fails

This commit is contained in:
Evert Prants 2021-12-15 19:40:06 +02:00
parent 7ec9cead2a
commit 6065dd55e3
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
3 changed files with 14 additions and 3 deletions

View File

@ -3,6 +3,7 @@ import tls, { TLSSocket } from 'tls';
import net, { Socket } from 'net'; import net, { Socket } from 'net';
import { IIRCLine, parse } from './parser'; import { IIRCLine, parse } from './parser';
import { EventEmitter } from 'events'; import { EventEmitter } from 'events';
import { logger } from '@squeebot/core/lib/core';
const MAXMSGLEN = 512; const MAXMSGLEN = 512;
export interface IIRCOptions { export interface IIRCOptions {
@ -119,8 +120,18 @@ export class IRC extends EventEmitter {
} }
const splitline = line.trailing.trim().split(' '); const splitline = line.trailing.trim().split(' ');
const authNumber = parseInt(splitline[2], 10);
let result = false; let result = false;
if (splitline[2] !== '0') { if (isNaN(authNumber)) {
this.options.nickserv.enabled = false;
data.func(false);
logger.warn(`[IRC] ${this.options.host} does not seem to support NickServ ${this.options.nickserv.command}`);
logger.warn(`[IRC] Their reply was: ${line.trailing}`);
return;
}
if (authNumber > 0) {
result = true; result = true;
} }

View File

@ -3,7 +3,7 @@
"name": "irc", "name": "irc",
"description": "IRC Service for Squeebot 3", "description": "IRC Service for Squeebot 3",
"tags": ["service", "irc"], "tags": ["service", "irc"],
"version": "1.2.0", "version": "1.2.1",
"dependencies": ["control?"], "dependencies": ["control?"],
"npmDependencies": [] "npmDependencies": []
} }

View File

@ -3,7 +3,7 @@
"plugins": [ "plugins": [
{ {
"name": "irc", "name": "irc",
"version": "1.2.0" "version": "1.2.1"
}, },
{ {
"name": "ircprototest", "name": "ircprototest",