|
@@ -134,3 +134,51 @@ async def selfie(req: Request, logger: Logger):
|
|
|
except:
|
|
|
logger.exception("Failed to call GOES16")
|
|
|
RollbotFailure.SERVICE_DOWN.raise_exc(detail="Failed to call GOES16")
|
|
|
+
|
|
|
+
|
|
|
+@as_command
|
|
|
+async def cat(req: Request, logger: Logger):
|
|
|
+ """
|
|
|
+ The !cat command grabs a cat from https://thiscatdoesnotexist.com/
|
|
|
+ """
|
|
|
+ try:
|
|
|
+ async with req.get(
|
|
|
+ "https://thiscatdoesnotexist.com/", headers={"User-Agent": "Rollbot"}
|
|
|
+ ) as res:
|
|
|
+ res.raise_for_status()
|
|
|
+ return Attachment("image", await res.read())
|
|
|
+ except:
|
|
|
+ logger.exception("Failed to call cat generator")
|
|
|
+ RollbotFailure.SERVICE_DOWN.raise_exc(detail="Failed to call cat generator")
|
|
|
+
|
|
|
+
|
|
|
+@as_command
|
|
|
+async def horse(req: Request, logger: Logger):
|
|
|
+ """
|
|
|
+ The !horse command grabs a horse from https://thishorsedoesnotexist.com/
|
|
|
+ """
|
|
|
+ try:
|
|
|
+ async with req.get(
|
|
|
+ "https://thishorsedoesnotexist.com/", headers={"User-Agent": "Rollbot"}
|
|
|
+ ) as res:
|
|
|
+ res.raise_for_status()
|
|
|
+ return Attachment("image", await res.read())
|
|
|
+ except:
|
|
|
+ logger.exception("Failed to call horse generator")
|
|
|
+ RollbotFailure.SERVICE_DOWN.raise_exc(detail="Failed to call horse generator")
|
|
|
+
|
|
|
+
|
|
|
+@as_command
|
|
|
+async def npc(req: Request, logger: Logger):
|
|
|
+ """
|
|
|
+ The !horse command grabs a person from https://thispersondoesnotexist.com/
|
|
|
+ """
|
|
|
+ try:
|
|
|
+ async with req.get(
|
|
|
+ "https://thispersondoesnotexist.com/", headers={"User-Agent": "Rollbot"}
|
|
|
+ ) as res:
|
|
|
+ res.raise_for_status()
|
|
|
+ return Attachment("image", await res.read())
|
|
|
+ except:
|
|
|
+ logger.exception("Failed to call person generator")
|
|
|
+ RollbotFailure.SERVICE_DOWN.raise_exc(detail="Failed to call person generator")
|