Kirk Trombley %!s(int64=5) %!d(string=hai) anos
pai
achega
23a40b3c7a
Modificáronse 1 ficheiros con 17 adicións e 2 borrados
  1. 17 2
      src/plugins/querying.py

+ 17 - 2
src/plugins/querying.py

@@ -219,17 +219,31 @@ def selfie(message):
 
     return run_upload(message, r.content)
 
+
 @as_plugin
 def cat(message):
     if message.raw_args is not None and "!explain" in message.raw_args:
-        return "The !cat grabs a cat from https://thiscatdoesnotexist.com/"
+        return "The !cat command grabs a cat from https://thiscatdoesnotexist.com/"
     try:
         r = requests.get("https://thiscatdoesnotexist.com/", headers={ "User-Agent": "Rollbot" })
     except ConnectionError as e:
         return RollbotFailure.SERVICE_DOWN.with_reason("Could not reach cat generator.").with_exception(e)
 
     return run_upload(message, r.content)
-    
+
+
+@as_plugin
+def npc(message):
+    if message.raw_args is not None and "!explain" in message.raw_args:
+        return "The !npc command grabs a person from https://thispersondoesnotexist.com/"
+    try:
+        r = requests.get("https://thispersondoesnotexist.com/image", headers={ "User-Agent": "Rollbot" })
+    except ConnectionError as e:
+        return RollbotFailure.SERVICE_DOWN.with_reason("Could not reach person generator.").with_exception(e)
+
+    return run_upload(message, r.content)
+
+
 @as_plugin
 def imagine(message):
     if message.raw_args is None:
@@ -253,6 +267,7 @@ def imagine(message):
     
     return RollbotResponse(message, img=result)
 
+
 art_number = 0
 
 @as_plugin