Skip to content

Commit

Permalink
core: expose IRC network name at bot.server.network
Browse files Browse the repository at this point in the history
Return IRC network name parsed from `RPL_ISUPPORT`, if present, else
return None.
  • Loading branch information
HumorBaby committed Apr 23, 2019
1 parent b34dab5 commit 444515b
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sopel/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,17 @@ class _ServerInfo(object): # Eventually this can become a Python 3 data class
hostname: A string containing 'servername' from RPL_MYINFO
_isupport: A dict containing parsed values from RPL_ISUPPORT.
network: A string with the IRC network name from RPL_ISUPPORT.
"""
def __init__(self):
self.capabilities = {}
self.hostname = None
self._isupport = collections.defaultdict(lambda: None) # Will be falsy when parameter not in RPL_ISUPPORT

network = property(lambda self: self._isupport['NETWORK'])
"""Return the name of the IRC network that the client is connected to."""


class Sopel(irc.Bot):
def __init__(self, config, daemon=False):
Expand Down

0 comments on commit 444515b

Please sign in to comment.