shizmob / pydle

An IRCv3-compliant Python 3 IRC library.
BSD 3-Clause "New" or "Revised" License
154 stars 48 forks source link

Single Client Multiple Servers? #116

Closed ixxie closed 5 years ago

ixxie commented 5 years ago

The documentation has an example of connecting multiple client objects to multiple servers in a single pool:

for server in servers:
    client = MyClient('MyBot')
    pool.connect(client, server, tls=True)

# Handle all clients in the pool at once.
pool.handle_forever()

I take it there is no way to connect a single client to multiple servers?

theunkn0wn1 commented 5 years ago

Unfortunately, at this time Pydle does not support a single client connecting to multiple IRC networks concurrently. This is evidenced by the signature of Client.message:

    async def message(self, target, message):

Where target is a string channel, and message is a string payload.

Many of Pydle's interfaces, such as pydle.client.message() are simply not designed for use against multiple servers at the same time in the same instance of the object. Thus, it would require a rather significant change in the API to add an argument specifying /which/ server to perform the action against.


In order to maintain a presence across IRC networks, you will need to instantiate your Client class multiple times, once per IRC network you intend to connect to.

ixxie commented 5 years ago

Well, that is disappointing but thanks for the clear answer. I guess this can be closed?