Last active
August 29, 2015 14:15
-
-
Save LordAro/97683b278bf4143edc21 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/csbot/plugins/xkcd.py b/csbot/plugins/xkcd.py | |
index ea895b5..96e1535 100644 | |
--- a/csbot/plugins/xkcd.py | |
+++ b/csbot/plugins/xkcd.py | |
@@ -83,8 +83,9 @@ class xkcd(Plugin): | |
raise self.XKCDError("Comic #{} is invalid. The latest is #{}" | |
.format(num, latest_num)) | |
except ValueError: | |
- # TODO: google search? | |
- raise self.XKCDError("Invalid comic number") | |
+ # Maybe it's a string? | |
+ # Get the num based on the url from a search result | |
+ num = self.search_integrate(user_str) | |
# Only happens for invalid comics (like 404) | |
if not requested: | |
@@ -93,6 +94,12 @@ class xkcd(Plugin): | |
return (requested["url"], requested["title"], | |
cap_string(requested["alt"], 120)) | |
+ | |
+ @Plugin.integrate_with('search') | |
+ def search_integrate(self, search): | |
+ # blah blah search stuff | |
+ pass | |
+ | |
@Plugin.integrate_with('linkinfo') | |
def linkinfo_integrate(self, linkinfo): | |
"""Handle recognised xkcd urls.""" |
alanbriolat
commented
Feb 23, 2015
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment