whois stuff
This commit is contained in:
parent
bb52c966ee
commit
20b1b5a98e
|
@ -23,7 +23,7 @@ read().then(() => {
|
|||
if (typeof output !== undefined && output !== 'undefined' && output) {
|
||||
let blah = JSON.stringify(output);
|
||||
if (blah != "Converting circular structure to JSON")
|
||||
e.reply(blah.length > 100 ? `holy fuck, Ausgabe wäre viel zu lang! (${blah.length} Zeichen :DDDDDD)` : blah);
|
||||
e.reply(blah.length > 220 ? `holy fuck, Ausgabe wäre viel zu lang! (${blah.length} Zeichen :DDDDDD)` : blah);
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
|
|
|
@ -22,7 +22,7 @@ class irc {
|
|||
motd: "",
|
||||
me: {},
|
||||
channel: [],
|
||||
user: []
|
||||
user: new Map()
|
||||
};
|
||||
this.socket = (this.options.ssl ? tls : net).connect({
|
||||
host: this.options.host,
|
||||
|
@ -35,7 +35,62 @@ class irc {
|
|||
this.socket.setEncoding('utf-8');
|
||||
this.socket.on('data', msg => {
|
||||
msg = this.parse(msg);
|
||||
let tmpuser = {};
|
||||
switch (msg.command) { // auslagern!
|
||||
// WHOIS BEGIN
|
||||
case "307": // Rizon Account
|
||||
tmpuser = {};
|
||||
if(this.server.user.has( msg.params[1]))
|
||||
tmpuser = this.server.user.get( msg.params[1] );
|
||||
tmpuser.account = msg.params[1];
|
||||
tmpuser.registered = true;
|
||||
this.server.user.set( msg.params[1], tmpuser );
|
||||
break;
|
||||
case "311": // first
|
||||
tmpuser = {};
|
||||
if(this.server.user.has( msg.params[1] ))
|
||||
tmpuser = this.server.user.get( msg.params[1] );
|
||||
tmpuser.nickname = msg.params[1];
|
||||
tmpuser.username = msg.params[2];
|
||||
tmpuser.hostname = msg.params[3];
|
||||
tmpuser.realname = msg.params[5];
|
||||
this.server.user.set( msg.params[1], tmpuser );
|
||||
break;
|
||||
case "313": // Oper
|
||||
tmpuser = {};
|
||||
if(this.server.user.has( msg.params[1] ))
|
||||
tmpuser = this.server.user.get( msg.params[1] );
|
||||
tmpuser.oper = true;
|
||||
this.server.user.set( msg.params[1], tmpuser );
|
||||
break;
|
||||
case "318": // last (check Data)
|
||||
tmpuser = {};
|
||||
if(this.server.user.has( msg.params[1] ))
|
||||
tmpuser = this.server.user.get( msg.params[1] );
|
||||
tmpuser = {
|
||||
nickname: tmpuser.nickname || false,
|
||||
username: tmpuser.username || false,
|
||||
hostname: tmpuser.hostname || false,
|
||||
realname: tmpuser.realname || false,
|
||||
account: tmpuser.account || false,
|
||||
registered: tmpuser.registered || false,
|
||||
oper: tmpuser.oper || false
|
||||
};
|
||||
this.server.user.set( msg.params[1], tmpuser );
|
||||
break;
|
||||
case "319": // Chanlist Todo
|
||||
//let tmpchan = {};
|
||||
//if(this.server.user.has(msg.params[1]))
|
||||
break;
|
||||
case "330": // Quarknet
|
||||
tmpuser = {};
|
||||
if(this.server.user.has( msg.params[1] ))
|
||||
tmpuser = this.server.user.get( msg.params[1] );
|
||||
tmpuser.account = msg.params[2];
|
||||
tmpuser.registered = true;
|
||||
this.server.user.set( msg.params[1], tmpuser );
|
||||
break;
|
||||
// WHOIS END
|
||||
case "001": // welcome
|
||||
this.server.me = msg.params[0];
|
||||
this.join(this.options.channels);
|
||||
|
@ -147,6 +202,7 @@ class irc {
|
|||
},
|
||||
// act chan
|
||||
_chan: this.server.channel[tmp.params[0]],
|
||||
_user: this.server.user,
|
||||
// commands
|
||||
join: chan => this.join(chan),
|
||||
part: (chan, msg) => this.part(chan, msg),
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { cfg, read } from './cfg.js';
|
||||
import { loadEvents } from './lib.js';
|
||||
//import { loadEvents } from './lib.js';
|
||||
|
||||
const irclib = require('./clients/irc.js');
|
||||
const tglib = require('./clients/tg.js')
|
||||
|
|
12
tmp.txt
12
tmp.txt
|
@ -45,3 +45,15 @@ Rizon:
|
|||
{ raw: ':irc.rizon.no 307 kbotv3 Flummi :has identified for this nick\r\n',
|
||||
{ raw: ':irc.rizon.no 671 kbotv3 Flummi :is using a secure connection\r\n',
|
||||
{ raw: ':irc.rizon.no 318 kbotv3 Flummi :End of /WHOIS list.\r\n',
|
||||
|
||||
|
||||
- '276': 'RPL_
|
||||
+ '307': 'RPL_WHOISREGNICK',
|
||||
+ '311': 'RPL_WHOISUSER',
|
||||
- '312': 'RPL_WHOISSERVER',
|
||||
~ '313': 'RPL_WHOISOPERATOR',
|
||||
- '317': 'RPL_WHOISIDLE',
|
||||
+ '318': 'RPL_ENDOFWHOIS',
|
||||
+ '319': 'RPL_WHOISCHANNELS',
|
||||
~ '335': 'RPL_WHOISBOT',
|
||||
~ '671': 'RPL_WHOISSECURE'
|
||||
|
|
Loading…
Reference in New Issue
Block a user