diff --git a/pyproject.toml b/pyproject.toml index b091f8b67..e3d08dc8f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,7 +11,7 @@ namespaces = false [project] name = "sopel" -version = "8.0.0" +version = "8.1.0.dev0" description = "Simple and extensible IRC bot" maintainers = [ { name="dgw" }, diff --git a/sopel/bot.py b/sopel/bot.py index abe2f506e..9bdc74398 100644 --- a/sopel/bot.py +++ b/sopel/bot.py @@ -716,9 +716,14 @@ def call( :param func: the function to call :type func: :term:`function` :param sopel: a SopelWrapper instance - :type sopel: :class:`SopelWrapper` - :param Trigger trigger: the Trigger object for the line from the server - that triggered this call + :param trigger: the Trigger object for the line from the server that + triggered this call + + .. deprecated:: 8.1 + + This method is deprecated and will be removed in Sopel 9.0. The + new rules system uses :meth:`call_rule` instead. + """ nick = trigger.nick current_time = time.time() @@ -1120,6 +1125,7 @@ def _shutdown(self) -> None: # Avoid calling shutdown methods if we already have. self.shutdown_methods = [] + # TODO: Remove in Sopel 9.0 # URL callbacks management @deprecated( diff --git a/sopel/builtins/url.py b/sopel/builtins/url.py index 66864d2e3..a3d070661 100644 --- a/sopel/builtins/url.py +++ b/sopel/builtins/url.py @@ -478,7 +478,8 @@ def check_callbacks( ) return ( excluded or - any(bot.search_url_callbacks(url)) or + # TODO: _url_callbacks is deprecated and will be removed in Sopel 9.0 + any(pattern.search(url) for pattern in bot._url_callbacks.keys()) or bot.rules.check_url_callback(bot, url) ) diff --git a/sopel/coretasks.py b/sopel/coretasks.py index 93b11dbd2..eaa1776fe 100644 --- a/sopel/coretasks.py +++ b/sopel/coretasks.py @@ -1612,15 +1612,21 @@ def track_topic(bot, trigger): def handle_url_callbacks(bot, trigger): """Dispatch callbacks on URLs - For each URL found in the trigger, trigger the URL callback registered by - the ``@url`` decorator. + For each URL found in the trigger, trigger the URL callback registered + through the now deprecated :meth:`sopel.bot.Sopel.register_url_callback`. + + .. deprecated:: 8.1 + + This is deprecated and will be removed in Sopel 9.0. + """ # find URLs in the trigger for url in trigger.urls: # find callbacks for said URL - for function, match in bot.search_url_callbacks(url): + for pattern, function in bot._url_callbacks.items(): + match = pattern.search(url) # trigger callback defined by the `@url` decorator - if hasattr(function, 'url_regex'): + if match and hasattr(function, 'url_regex'): # bake the `match` argument in before passing the callback on @functools.wraps(function) def decorated(bot, trigger):