shizmob / pydle

An IRCv3-compliant Python 3 IRC library.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

NickServ Documentation and/or Support

ixxie opened this issue · comments

While not strictly part of IRC protocols, NickServ is a fixture of IRC life and some basic documentation on how to implement NickServ authentication with pydle would be helpful.

I imagine getting API support for this might fall out of scope for this library though, so I can see why it wouldn't be pursued, but for implementing bots it would certainly be handy.

Pydle has builtin support for authenticating against nickserv via SASL, as provided by the tls and IRCv3 features. These features are present but disabled by default when using the fully featurized pydle client (pydle.Client)

To connect using tls, you should pass tls=True as a keyword argument to the Client constructor.

To configure the credentials to be presented to services (Nickserv) during connection, you can pass them as keyword arguments to your bot's Pydle constructor.

For username, password (SASL username+password) use the following arguments,

client = pydle.Client(nickname="my_irc_bot[bot]",
                      sasl_username="my_sasl_username",
                      sasl_password="super s3cret password",
                      sasl_identity = "account_to_authenticate_against",
                      # other kwargs go here
                      )

To use Certificate based authentication (SASL External) its slightly different,

client = pydle.Client(nickname="my_irc_bot[bot]",
                      sasl_mechanism = "EXTERNAL",
                      tls_client_cert = "/path/to/client_certificate"
                      )

As for the documentation, I will investigate how i can revise them as to push authentication closer to the top so its easier to find.

Thank you that is helpful! I for my part didn't know the term SASL so also refering to NickServ would help those of us less familiar with IRC RFCs.

Since this is common to use in bots, you may consider adding it to the example bot on the readme; that was were I first looked as I like to learn by examples.