def __init__(self, config, daemon=False): super(Sopel, self).__init__(config) self._daemon = daemon # Used for iPython. TODO something saner here self.wantsrestart = False self._running_triggers = [] self._running_triggers_lock = threading.Lock() self._plugins = {} self._rules_manager = plugin_rules.Manager() self._scheduler = plugin_jobs.Scheduler(self) self._times = {} """ A dictionary mapping lowercased nicks to dictionaries which map function names to the time which they were last used by that nick. """ self.server_capabilities = {} """A dict mapping supported IRCv3 capabilities to their options. For example, if the server specifies the capability ``sasl=EXTERNAL``, it will be here as ``{"sasl": "EXTERNAL"}``. Capabilities specified without any options will have ``None`` as the value. For servers that do not support IRCv3, this will be an empty set. """ self.privileges = dict() """A dictionary of channels to their users and privilege levels. The value associated with each channel is a dictionary of :class:`sopel.tools.Identifier`\\s to a bitwise integer value, determined by combining the appropriate constants from :mod:`sopel.plugin`. .. deprecated:: 6.2.0 Use :attr:`channels` instead. Will be removed in Sopel 8. """ self.channels = tools.SopelIdentifierMemory() """A map of the channels that Sopel is in. The keys are :class:`sopel.tools.Identifier`\\s of the channel names, and map to :class:`sopel.tools.target.Channel` objects which contain the users in the channel and their permissions. """ self.users = tools.SopelIdentifierMemory() """A map of the users that Sopel is aware of. The keys are :class:`sopel.tools.Identifier`\\s of the nicknames, and map to :class:`sopel.tools.target.User` instances. In order for Sopel to be aware of a user, it must share at least one mutual channel. """ self.db = SopelDB(config) """The bot's database, as a :class:`sopel.db.SopelDB` instance.""" self.memory = tools.SopelMemory() """ A thread-safe dict for storage of runtime data to be shared between plugins. See :class:`sopel.tools.SopelMemory`. """ self.shutdown_methods = [] """List of methods to call on shutdown."""
def __init__(self, config, daemon=False): super().__init__(config) self._daemon = daemon # Used for iPython. TODO something saner here self._running_triggers = [] self._running_triggers_lock = threading.Lock() self._plugins: Dict[str, Any] = {} self._rules_manager = plugin_rules.Manager() self._scheduler = plugin_jobs.Scheduler(self) self._url_callbacks = tools.SopelMemory() """Tracking of manually registered URL callbacks. Should be manipulated only by use of :meth:`register_url_callback` and :meth:`unregister_url_callback` methods, which are deprecated. Remove in Sopel 9, along with the above related methods. """ self._times = {} """ A dictionary mapping lowercased nicks to dictionaries which map function names to the time which they were last used by that nick. """ self.server_capabilities = {} """A dict mapping supported IRCv3 capabilities to their options. For example, if the server specifies the capability ``sasl=EXTERNAL``, it will be here as ``{"sasl": "EXTERNAL"}``. Capabilities specified without any options will have ``None`` as the value. For servers that do not support IRCv3, this will be an empty set. """ self.modeparser = modes.ModeParser() """A mode parser used to parse ``MODE`` messages and modestrings.""" self.channels = tools.SopelIdentifierMemory( identifier_factory=self.make_identifier, ) """A map of the channels that Sopel is in. The keys are :class:`~sopel.tools.identifiers.Identifier`\\s of the channel names, and map to :class:`~sopel.tools.target.Channel` objects which contain the users in the channel and their permissions. """ self.users = tools.SopelIdentifierMemory( identifier_factory=self.make_identifier, ) """A map of the users that Sopel is aware of. The keys are :class:`~sopel.tools.identifiers.Identifier`\\s of the nicknames, and map to :class:`~sopel.tools.target.User` instances. In order for Sopel to be aware of a user, it must share at least one mutual channel. """ self.db = db.SopelDB(config, identifier_factory=self.make_identifier) """The bot's database, as a :class:`sopel.db.SopelDB` instance.""" self.memory = tools.SopelMemory() """ A thread-safe dict for storage of runtime data to be shared between plugins. See :class:`sopel.tools.memories.SopelMemory`. """ self.shutdown_methods = [] """List of methods to call on shutdown."""