diff --git a/sopel/modules/url.py b/sopel/modules/url.py index 63ba358596..c12465eb10 100644 --- a/sopel/modules/url.py +++ b/sopel/modules/url.py @@ -21,7 +21,7 @@ from urllib3.exceptions import LocationValueError # type: ignore[import] from sopel import plugin, tools -from sopel.bot import Sopel +from sopel.bot import Sopel, SopelWrapper from sopel.config import Config, types from sopel.tools import web from sopel.trigger import Trigger @@ -149,7 +149,7 @@ def shutdown(bot: Sopel): @plugin.example('.urlpexclude example\\.com/\\w+', user_help=True) @plugin.example('.urlexclude example.com/path', user_help=True) @plugin.output_prefix('[url] ') -def url_ban(bot: Sopel, trigger: Trigger): +def url_ban(bot: SopelWrapper, trigger: Trigger): """Exclude a URL from auto title. Use ``urlpexclude`` to exclude a pattern instead of a URL. @@ -194,7 +194,7 @@ def url_ban(bot: Sopel, trigger: Trigger): @plugin.example('.urlpallow example\\.com/\\w+', user_help=True) @plugin.example('.urlallow example.com/path', user_help=True) @plugin.output_prefix('[url] ') -def url_unban(bot: Sopel, trigger: Trigger): +def url_unban(bot: SopelWrapper, trigger: Trigger): """Allow a URL for auto title. Use ``urlpallow`` to allow a pattern instead of a URL. @@ -241,7 +241,7 @@ def url_unban(bot: Sopel, trigger: Trigger): 'Google | www.google.com', online=True, vcr=True) @plugin.output_prefix('[url] ') -def title_command(bot: Sopel, trigger: Trigger): +def title_command(bot: SopelWrapper, trigger: Trigger): """ Show the title or URL information for the given URL, or the last URL seen in this channel. @@ -281,7 +281,7 @@ def title_command(bot: Sopel, trigger: Trigger): @plugin.rule(r'(?u).*(https?://\S+).*') @plugin.output_prefix('[url] ') -def title_auto(bot: Sopel, trigger: Trigger): +def title_auto(bot: SopelWrapper, trigger: Trigger): """ Automatically show titles for URLs. For shortened URLs/redirects, find where the URL redirects to and show the title for that (or call a function @@ -315,7 +315,7 @@ def title_auto(bot: Sopel, trigger: Trigger): def process_urls( - bot: Sopel, trigger: Trigger, urls: List[str], requested: bool = False + bot: SopelWrapper, trigger: Trigger, urls: List[str], requested: bool = False ) -> Generator[Tuple[str, str, Optional[str], Optional[str], bool], None, None]: """ For each URL in the list, ensure it should be titled, and do so. @@ -381,7 +381,7 @@ def process_urls( yield (url, title, parsed_url.hostname, tinyurl, False) -def check_callbacks(bot: Sopel, url: str, use_excludes: bool = True) -> bool: +def check_callbacks(bot: SopelWrapper, url: str, use_excludes: bool = True) -> bool: """Check if ``url`` is excluded or matches any URL callback patterns. :param bot: Sopel instance @@ -464,7 +464,7 @@ def find_title(url: str, verify: bool = True) -> Optional[str]: return title or None -def get_or_create_shorturl(bot: Sopel, url: str) -> str: +def get_or_create_shorturl(bot: SopelWrapper, url: str) -> str: """Get or create a short URL for ``url`` :param bot: Sopel instance