Kirk Trombley 4 years ago
parent
commit
0aaa4c1e28
1 changed files with 11 additions and 0 deletions
  1. 11 0
      src/plugins/querying.py

+ 11 - 0
src/plugins/querying.py

@@ -220,6 +220,17 @@ def cat(message):
     return run_upload(message, r.content)
 
 
+@with_help("The !horse command grabs a cat from https://thishorsedoesnotexist.com/")
+@as_plugin
+def horse(message):
+    try:
+        r = requests.get("https://thishorsedoesnotexist.com/", headers={ "User-Agent": "Rollbot" })
+    except ConnectionError as e:
+        return RollbotFailure.SERVICE_DOWN.with_reason("Could not reach horse generator.").with_exception(e)
+
+    return run_upload(message, r.content)
+
+
 @with_help("The !npc command grabs a person from https://thispersondoesnotexist.com/")
 @as_plugin
 def npc(message):