Giter Site home page Giter Site logo

Channel key support about logbot HOT 3 OPEN

timypcr avatar timypcr commented on July 3, 2024
Channel key support

from logbot.

Comments (3)

FiXato avatar FiXato commented on July 3, 2024

the c.join command at

logbot/logbot.py

Lines 359 to 360 in db89264

for chan in self.chans:
c.join(chan)
theoretically supports a second parameter for a channel key:

logbot/irclib.py

Lines 689 to 691 in db89264

def join(self, channel, key=""):
"""Send a JOIN command."""
self.send_raw("JOIN %s%s" % (channel, (key and (" " + key))))

Channels are set at

self.chans = [x.lower() for x in channels]

So, it doesn't look like there is a clean way to quickly do it without rewriting things.

Since channel names should not contain spaces, you could add a space + channel key to your channels defined at

CHANNELS=["#excid3","#keryx"]

Then extract the channel keys with a split before they are lowercased and assigned to self.chan, and then use that as a second parameter at the join command.

I don't really use this library myself anymore, so to be fair, I don't really have the motivation to submit a pull request with working code for this feature request, but hopefully this helps you (or @excid3) add a workaround yourself. :)

from logbot.

FiXato avatar FiXato commented on July 3, 2024

If someone does end up rewriting it, I would suggest you make use of the IRC protocol's format of the JOIN command: https://tools.ietf.org/html/rfc2812#page-16
And just have the user define the channels and keys in the argument format the server expects; the actual channel names could then be extracted (and downcased if you want) from the actual join replies from the server. That way you don't have to match up the channel keys with each channel, and just rely on the server to do the matching (as long as the keys are entered in the right order as the channels; AFAIK it doesn't matter though if there are channels without keys in between those that require one; the server should be smart enough).
Basically use comma delimiters for the channel names, followed by a space, followed by comma-separated channel keys.

from logbot.

excid3 avatar excid3 commented on July 3, 2024

Since keys is just a second parameter, you can create a KEYS array next to channels and then just pass those in during this loop:

logbot/logbot.py

Lines 359 to 360 in db89264

for chan in self.chans:
c.join(chan)

Should be really simple to fix.

from logbot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.