kiwiirc / irc-framework

🛠️ A better IRC framework for node.js. For bots and full clients.
MIT License
180 stars 62 forks source link

Problem RPL_WHOISCOUNTRY on UnrealIRCd 6.0.x : Does not retrieve country code #341

Closed Madriix closed 1 year ago

Madriix commented 1 year ago

Today I updated irc-framework in my project, it hadn't been updated for 1 year. I encountered a bug on this file: https://github.com/kiwiirc/irc-framework/pull/318/commits/34683a7181aa1d3c384a2cf914149f13019906b8 https://github.com/kiwiirc/irc-framework/blob/master/src/commands/handlers/user.js#L294

I had to replace this line: cache.country = command.params[command.params.length - 1]; by this one: cache.country = command.params[2];

The first line displays this entire line: is connecting from France and the second line replaced, it displays only country codes like FR, BE, DE ...

ItsOnlyBinary commented 1 year ago

Could you please console.log(command) for a whois, this has been reported before, but is different for both inspircd and unrealircd. I would need to find a way that works for both.

Madriix commented 1 year ago

I just tested this:

    RPL_WHOISCOUNTRY: function(command, handler) {
        const cache_key = command.params[1].toLowerCase();
        const cache = handler.cache('whois.' + cache_key);
        //cache.country = command.params[command.params.length - 1];
    cache.country = command.params[2];
    console.log(command);
    process.exit(1);
    },

Here is the returned log:


IrcCommand {
  command: '344',
  params: [ 'Sysop', 'Corail', 'CA', 'is connecting from Canada' ],
  tags: {},
  prefix: 'irc.xx.com',
  nick: '',
  ident: '',
  hostname: 'irc.xx.com'
}

Sysop is the name of the nodejs robot

ItsOnlyBinary commented 1 year ago

Thanks, so you are just wanting the country code? not the actual string with name?

Madriix commented 1 year ago

Yes just "CA"