reactiflux / discord-irc

Connects Discord and IRC channels by sending messages back and forth.
MIT License
1.2k stars 293 forks source link

show who is on IRC from discord and vice versa #92

Closed ask-compu closed 7 years ago

ask-compu commented 8 years ago

you should add commands so people on discord can see who is on IRC and vice versa, it would also be nice to see IRC nick changes, joins, quits, and parts from discord, maybe make it an option to show or hide such messages

creesch commented 8 years ago

You can do the other way around easily by enabling discord widgets. This would allow you to have a window open with the people active on discord on it. If you use a webbased irc client like irccloud you can even make a userscript and append it to the userlist.

ask-compu commented 8 years ago

that is not ideal and doesnt address showing whos on irc from the discord side

creesch commented 8 years ago

I realize that, I was just giving a suggestion that works until such commands as you asked for are implemented.

dwhagar commented 7 years ago

Showing who is on the IRC side can be done via a /names command, the response from that shows all nicks in the channel. A subsequent /who commands on each nick can give more information, but the /names should provide all the information one would need.

ask-compu commented 7 years ago

@dwhagar but u cant do /names and /who through the bridge from discord

dwhagar commented 7 years ago

Yes but the bridge could relay the commands and process the responses.

On Oct 11, 2016, at 10:50 PM, Compu notifications@github.com wrote:

@dwhagar but u cant do /names and /who through the bridge from discord

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

ask-compu commented 7 years ago

@dwhagar that could work but it might be best to give the response in PM on either end so it doesnt spam the channel/server

dwhagar commented 7 years ago

I agree I have an IRC bot written in python3 that processes names and who responses.

On Oct 12, 2016, at 8:44 AM, Compu notifications@github.com wrote:

@dwhagar that could work but it might be best to give the response in PM on either end so it doesnt spam the channel/server

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

ask-compu commented 7 years ago

@dwhagar i have a python3 irc bot that does all kinds of stuff

dwhagar commented 7 years ago

Nice we should compare notes.

On Oct 12, 2016, at 8:57 AM, Compu notifications@github.com wrote:

@dwhagar i have a python3 irc bot that does all kinds of stuff

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

ask-compu commented 7 years ago

@dwhagar just click on my profile and look for the compubot repository

LordAlderaan commented 7 years ago

I got it working one way. Discord is showing a list of people in IRC in the subject of a channel by changing bot.js in the following matter.

Add to the attachListeners section of the Bot class:

    // When a list of names on a channel is received on IRC set the topic on the corresponding Discord channel to a list of those names
    this.ircClient.on('names', (channel, nicks) => {
      _winston2.default.debug('Names:', channel, ' Nicks:', Object.keys(nicks).join(', '));
      this.setTopicDiscord(channel,`Online at IRC: ${Object.keys(nicks).join(', ')}`);
    });

    // Trigger requesting a list of names on a IRC channel
    this.ircClient.on('join', (channel, nick, message) => {
      if (nick !== this.nickname) {
        _winston2.default.debug('Join:', channel, nick);
        this.checkIrcNames(channel);
      }
    });

    this.ircClient.on('part', (channel, nick, reason, message) => {
      if (nick !== this.nickname) {
        _winston2.default.debug('Part: ', channel, nick);
        this.checkIrcNames(channel);
      }
    });

    this.ircClient.on('quit', (nick,reason,channels,message) => {
      _winston2.default.debug('Quit: ', nick, 'from', Object.keys(channels).join(', '));
      channels.forEach(channel => {
          this.checkIrcNames(channel);
        });
    });

    this.ircClient.on('kick', (channel,nick,by,reason,message) => {
      _winston2.default.debug('Kick: ', channel, nick);
      this.checkIrcNames(channel);
    });

Add to the bot class. For example right before the last } symbol in the file:

  // Request a list of names from a channel on IRC
  checkIrcNames(channel) {
      _winston2.default.debug('Request names: ', channel);
      this.ircClient.send('names',channel);
  }

  // Update a topic in Discord based on the corresponding channel name on IRC
  setTopicDiscord(channel, topic) {
    const discordChannelName = this.invertedMapping[channel.toLowerCase()];
    if (discordChannelName) {
      // #channel -> channel before retrieving:
      const discordChannel = this.discord.channels.find('name', discordChannelName.slice(1));

      if (!discordChannel) {
        _winston2.default.info('Tried to change topic of a channel the bot isn\'t in: ', discordChannelName);
        return;
      }

      _winston2.default.debug('Changing topic in Discord:', discordChannelName, topic);
      discordChannel.setTopic(topic);
    }
  }
ask-compu commented 7 years ago

the topic has limited character length on IRC and is used for other things in pretty much every registered channel ever

LordAlderaan commented 7 years ago

Good points both. Neither are an issue where I personally use discord-irc and created this tweak. I simply thought I might as well share my code as a step in finding and creating a more robust solution.

dwhagar commented 7 years ago

Not a prefect solution, but definitely a worthwhile idea. I would still prefer the bot to relay joins/parts from IRC to Discord, but this is definitely a great idea.

David Wade Hagar david.hagar@gmail.com http://home.blazingumbra.com/cyclops.html

The freedom of expression protects you from governmental prosecution for something you've said. It does not, nor has it ever, protected you from potentially harmful reactions of friends, neighbors, or employers, because you've said something stupid. Doing so would infringe on their freedom of expression.

On Oct 24, 2016, at 7:01 PM, LordAlderaan notifications@github.com wrote:

I got it working one way. Discord is showing a list of people in IRC in the subject of a channel by changing bot.js in the following matter.

Add to the attachListeners section of the Bot class:

// When a list of names on a channel is received on IRC set the topic on the corresponding Discord channel to a list of those names
this.ircClient.on('names', (channel, nicks) => {
  _winston2.default.debug('Names:', channel, ' Nicks:', Object.keys(nicks).join(', '));
  this.setTopicDiscord(channel,`Online at IRC: ${Object.keys(nicks).join(', ')}`);
});

// Trigger requesting a list of names on a IRC channel
this.ircClient.on('join', (channel, nick, message) => {
  if (nick !== this.nickname) {
    _winston2.default.debug('Join:', channel, nick);
    this.checkIrcNames(channel);
  }
});

this.ircClient.on('part', (channel, nick, reason, message) => {
  if (nick !== this.nickname) {
    _winston2.default.debug('Part: ', channel, nick);
    this.checkIrcNames(channel);
  }
});

this.ircClient.on('quit', (nick,reason,channels,message) => {
  _winston2.default.debug('Quit: ', nick, 'from', Object.keys(channels).join(', '));
  channels.forEach(channel => {
      this.checkIrcNames(channel);
    });
});

this.ircClient.on('kick', (channel,nick,by,reason,message) => {
  _winston2.default.debug('Kick: ', channel, nick);
  this.checkIrcNames(channel);
});

Add to the bot class. For example right before the last } symbol in the file:

// Request a list of names from a channel on IRC checkIrcNames(channel) { _winston2.default.debug('Request names: ', channel); this.ircClient.send('names',channel); }

// Update a topic in Discord based on the corresponding channel name on IRC setTopicDiscord(channel, topic) { const discordChannelName = this.invertedMapping[channel.toLowerCase()]; if (discordChannelName) { // #channel -> channel before retrieving: const discordChannel = this.discord.channels.find('name', discordChannelName.slice(1));

  if (!discordChannel) {
    _winston2.default.info('Tried to change topic of a channel the bot isn\'t in: ', discordChannelName);
    return;
  }

  _winston2.default.debug('Changing topic in Discord:', discordChannelName, topic);
  discordChannel.setTopic(topic);
}

} — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/reactiflux/discord-irc/issues/92#issuecomment-255890164, or mute the thread https://github.com/notifications/unsubscribe-auth/AF5kmtYm8izrLILiTGfyB48IFwgBMeFGks5q3Ti9gaJpZM4JZKVS.

ekmartin commented 7 years ago

Closing this since #207 was merged. It doesn't completely solve the issue, but I think adding special command support to the project is too out of scope.