浏览代码

NPC command

Kirk Trombley 5 年之前
父节点
当前提交
23a40b3c7a
共有 1 个文件被更改,包括 17 次插入2 次删除
  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)
     return run_upload(message, r.content)
 
 
+
 @as_plugin
 @as_plugin
 def cat(message):
 def cat(message):
     if message.raw_args is not None and "!explain" in message.raw_args:
     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:
     try:
         r = requests.get("https://thiscatdoesnotexist.com/", headers={ "User-Agent": "Rollbot" })
         r = requests.get("https://thiscatdoesnotexist.com/", headers={ "User-Agent": "Rollbot" })
     except ConnectionError as e:
     except ConnectionError as e:
         return RollbotFailure.SERVICE_DOWN.with_reason("Could not reach cat generator.").with_exception(e)
         return RollbotFailure.SERVICE_DOWN.with_reason("Could not reach cat generator.").with_exception(e)
 
 
     return run_upload(message, r.content)
     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
 @as_plugin
 def imagine(message):
 def imagine(message):
     if message.raw_args is None:
     if message.raw_args is None:
@@ -253,6 +267,7 @@ def imagine(message):
     
     
     return RollbotResponse(message, img=result)
     return RollbotResponse(message, img=result)
 
 
+
 art_number = 0
 art_number = 0
 
 
 @as_plugin
 @as_plugin