|
21 | 21 | from urllib3.exceptions import LocationValueError # type: ignore[import] |
22 | 22 |
|
23 | 23 | from sopel import plugin, tools |
24 | | -from sopel.bot import Sopel |
| 24 | +from sopel.bot import Sopel, SopelWrapper |
25 | 25 | from sopel.config import Config, types |
26 | 26 | from sopel.tools import web |
27 | 27 | from sopel.trigger import Trigger |
@@ -149,7 +149,7 @@ def shutdown(bot: Sopel): |
149 | 149 | @plugin.example('.urlpexclude example\\.com/\\w+', user_help=True) |
150 | 150 | @plugin.example('.urlexclude example.com/path', user_help=True) |
151 | 151 | @plugin.output_prefix('[url] ') |
152 | | -def url_ban(bot: Sopel, trigger: Trigger): |
| 152 | +def url_ban(bot: SopelWrapper, trigger: Trigger): |
153 | 153 | """Exclude a URL from auto title. |
154 | 154 |
|
155 | 155 | Use ``urlpexclude`` to exclude a pattern instead of a URL. |
@@ -194,7 +194,7 @@ def url_ban(bot: Sopel, trigger: Trigger): |
194 | 194 | @plugin.example('.urlpallow example\\.com/\\w+', user_help=True) |
195 | 195 | @plugin.example('.urlallow example.com/path', user_help=True) |
196 | 196 | @plugin.output_prefix('[url] ') |
197 | | -def url_unban(bot: Sopel, trigger: Trigger): |
| 197 | +def url_unban(bot: SopelWrapper, trigger: Trigger): |
198 | 198 | """Allow a URL for auto title. |
199 | 199 |
|
200 | 200 | Use ``urlpallow`` to allow a pattern instead of a URL. |
@@ -241,7 +241,7 @@ def url_unban(bot: Sopel, trigger: Trigger): |
241 | 241 | 'Google | www.google.com', |
242 | 242 | online=True, vcr=True) |
243 | 243 | @plugin.output_prefix('[url] ') |
244 | | -def title_command(bot: Sopel, trigger: Trigger): |
| 244 | +def title_command(bot: SopelWrapper, trigger: Trigger): |
245 | 245 | """ |
246 | 246 | Show the title or URL information for the given URL, or the last URL seen |
247 | 247 | in this channel. |
@@ -281,7 +281,7 @@ def title_command(bot: Sopel, trigger: Trigger): |
281 | 281 |
|
282 | 282 | @plugin.rule(r'(?u).*(https?://\S+).*') |
283 | 283 | @plugin.output_prefix('[url] ') |
284 | | -def title_auto(bot: Sopel, trigger: Trigger): |
| 284 | +def title_auto(bot: SopelWrapper, trigger: Trigger): |
285 | 285 | """ |
286 | 286 | Automatically show titles for URLs. For shortened URLs/redirects, find |
287 | 287 | 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): |
315 | 315 |
|
316 | 316 |
|
317 | 317 | def process_urls( |
318 | | - bot: Sopel, trigger: Trigger, urls: List[str], requested: bool = False |
| 318 | + bot: SopelWrapper, trigger: Trigger, urls: List[str], requested: bool = False |
319 | 319 | ) -> Generator[Tuple[str, str, Optional[str], Optional[str], bool], None, None]: |
320 | 320 | """ |
321 | 321 | For each URL in the list, ensure it should be titled, and do so. |
@@ -381,7 +381,7 @@ def process_urls( |
381 | 381 | yield (url, title, parsed_url.hostname, tinyurl, False) |
382 | 382 |
|
383 | 383 |
|
384 | | -def check_callbacks(bot: Sopel, url: str, use_excludes: bool = True) -> bool: |
| 384 | +def check_callbacks(bot: SopelWrapper, url: str, use_excludes: bool = True) -> bool: |
385 | 385 | """Check if ``url`` is excluded or matches any URL callback patterns. |
386 | 386 |
|
387 | 387 | :param bot: Sopel instance |
@@ -464,7 +464,7 @@ def find_title(url: str, verify: bool = True) -> Optional[str]: |
464 | 464 | return title or None |
465 | 465 |
|
466 | 466 |
|
467 | | -def get_or_create_shorturl(bot: Sopel, url: str) -> str: |
| 467 | +def get_or_create_shorturl(bot: SopelWrapper, url: str) -> str: |
468 | 468 | """Get or create a short URL for ``url`` |
469 | 469 |
|
470 | 470 | :param bot: Sopel instance |
|
0 commit comments