aj00200 / BBot

BBot is a Python IRC bot which aims to be fast, modular, and offer a great API!
http://www.aj00200.org/projects/bbot/index.htm
7 stars 4 forks source link

Add WHOIS support #15

Open Kudu opened 12 years ago

Kudu commented 12 years ago

I suggest adding WHOIS support to the API. The interface would be somewhat like this:

class Module(object):
    def whois(nick, callback):
        """Request a WHOIS for the specified nickname.

        :param nick: the user's nickname
        :type nick: str.
        :param callback: object to call when the client has received all the WHOIS information
        :type callback: callable, usually a function.

        The callback object will be called with a dictionary like this:

        .. codeblock:: python
           {
               nick: "ku",
               user: "ku", # 311
               host: "polywiki/steward/ku", # 311
               gecos: "ku", # 311
               channels: ["##bbot"], # 319
               server: "verne.freenode.net", # 312
               serverinfo: "Newark, NJ, US", # 312
               secure: "is using a secure connection", # 671
               account: "kudu", # 330
               accountinfo: "is logged in as", # 330
               operator: "is an IRC Operator" # 313, and not actually true
           }

        """
        pass

By the way, the "End of WHOIS" command is 318.