ISUPPORT#
IRC Tools for ISUPPORT management.
When a server wants to advertise its features and settings, it can use the
RPL_ISUPPORT command (005 numeric) with a list of arguments.
- class sopel.irc.isupport.ISupport(**kwargs)#
Storage class for IRC’s
ISUPPORTfeature.An instance of
ISupportcan be used as a read-only dict, to store features advertised by the IRC server:>>> isupport = ISupport(chanlimit=(('&', None), ('#', 70))) >>> isupport['CHANLIMIT'] (('&', None) ('#', 70)) >>> isupport.CHANLIMIT # some parameters are also properties { '&': None, '#': 70, } >>> 'chanlimit' in isupport # case-insensitive True >>> 'chanmode' in isupport False >>> isupport.CHANMODE # not advertised by the server! Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'ISupport' object has no attribute 'CHANMODE'
The list of possible parameters can be found at modern.ircdocs.horse’s RPL_ISUPPORT Parameters.
Important
While this object’s attributes and dict-like behavior are part of Sopel’s public API, its methods are considered internal code and plugins should not call them.
- property CHANLIMIT#
Expose
CHANLIMITas a dict, if advertised by the server.This exposes information about the maximum number of channels that the bot can join for each prefix:
>>> isupport.CHANLIMIT { '#': 70, '&': None, }
In that example, the bot may join 70
#channels and any number of&channels.This attribute is not available if the server does not provide the right information, and accessing it will raise an
AttributeError.
- property CHANMODES#
Expose
CHANMODESas a dict.This exposes information about 4 types of channel modes:
>>> isupport.CHANMODES { 'A': 'b', 'B': 'k', 'C': 'l', 'D': 'imnpst', }
The values are empty if the server does not provide this information.
- property MAXLIST#
Expose
MAXLISTas a dict, if advertised by the server.This exposes information about maximums for combinations of modes:
>>> isupport.MAXLIST { 'beI': 100, 'q': 50, 'b': 50, }
This attribute is not available if the server does not provide the right information, and accessing it will raise an
AttributeError.
- property PREFIX: dict[str, str]#
Expose
PREFIXas a dict, if advertised by the server.This exposes information about the modes and nick prefixes used for user privileges in channels:
>>> isupport.PREFIX { 'q': '~', 'a': '&', 'o': '@', 'h': '%', 'v': '+', }
Entries are in order of descending privilege.
This attribute is not available if the server does not provide the right information, and accessing it will raise an
AttributeError.
- property TARGMAX#
Expose
TARGMAXas a dict, if advertised by the server.This exposes information about the maximum number of arguments for each command:
>>> isupport.TARGMAX { 'JOIN': None, 'PRIVMSG': 3, 'WHOIS': 1, } >>> isupport['TARGMAX'] # internal representation (('JOIN', None), ('PRIVMSG', 3), ('WHOIS', 1))
This attribute is not available if the server does not provide the right information, and accessing it will raise an
AttributeError.The internal representation of
TARGMAXis a tuple of 2-value tuples as seen above.
- apply(**kwargs)#
Build a new instance of
ISupport.- Returns:
a new instance, updated with the latest advertised features
- Return type:
This method applies the latest advertised features from the server: the result contains the new and updated parameters, and doesn’t contain the removed parameters (marked by
-{PARAMNAME}):>>> updated = {'-AWAYLEN': None, 'NICKLEN': 25, 'CHANNELLEN': 10} >>> new = isupport.apply(**updated) >>> 'CHANNELLEN' in new True >>> 'AWAYLEN' in new False