|
@@ -1,4 +1,3 @@
|
|
|
-from cmath import log
|
|
|
from logging import Logger
|
|
|
import random
|
|
|
import asyncio
|
|
@@ -10,8 +9,11 @@ from commands.teamspeak import teamspeak
|
|
|
|
|
|
from rollbot import as_command, RollbotFailure, Attachment
|
|
|
from rollbot.injection import Request, Args, Arg, Config, Reply
|
|
|
+from rollbot.types import Command
|
|
|
|
|
|
|
|
|
+@as_command("interpret")
|
|
|
+@as_command("horoscope")
|
|
|
@as_command
|
|
|
async def inspire(req: Request, logger: Logger):
|
|
|
"""
|
|
@@ -157,57 +159,28 @@ async def riddle(args: Args, req: Request, logger: Logger, sleep: Config("riddle
|
|
|
yield "\n\n".join(("Here's the riddle answer from before!", riddle, answer))
|
|
|
|
|
|
|
|
|
-@as_command
|
|
|
-async def selfie(req: Request, logger: Logger):
|
|
|
- try:
|
|
|
- async with req.get(
|
|
|
- "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/ne/GEOCOLOR/latest.jpg"
|
|
|
- ) as res:
|
|
|
- res.raise_for_status()
|
|
|
- return Attachment("image", await res.read())
|
|
|
- except:
|
|
|
- logger.exception("Failed to call GOES16")
|
|
|
- RollbotFailure.SERVICE_DOWN.raise_exc(detail="Failed to call GOES16")
|
|
|
-
|
|
|
-
|
|
|
-@as_command
|
|
|
-async def southie(req: Request, logger: Logger):
|
|
|
- try:
|
|
|
- async with req.get(
|
|
|
- "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/se/GEOCOLOR/latest.jpg"
|
|
|
- ) as res:
|
|
|
- res.raise_for_status()
|
|
|
- return Attachment("image", await res.read())
|
|
|
- except:
|
|
|
- logger.exception("Failed to call GOES16")
|
|
|
- RollbotFailure.SERVICE_DOWN.raise_exc(detail="Failed to call GOES16")
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
-@as_command
|
|
|
-async def southier(req: Request, logger: Logger):
|
|
|
- try:
|
|
|
- async with req.get(
|
|
|
- "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/gm/GEOCOLOR/latest.jpg"
|
|
|
- ) as res:
|
|
|
- res.raise_for_status()
|
|
|
- return Attachment("image", await res.read())
|
|
|
- except:
|
|
|
- logger.exception("Failed to call GOES16")
|
|
|
- RollbotFailure.SERVICE_DOWN.raise_exc(detail="Failed to call GOES16")
|
|
|
-
|
|
|
+SELFIE_SECTORS = {
|
|
|
+ "selfie": "ne", # Northeast
|
|
|
+ "southie": "se", # Southeast
|
|
|
+ "southier": "gm", # Gulf of Mexico
|
|
|
+ "seaboardie": "eus", # Eastern US
|
|
|
+}
|
|
|
|
|
|
-@as_command
|
|
|
-async def seaboardie(req: Request, logger: Logger):
|
|
|
+@as_command("southie")
|
|
|
+@as_command("southier")
|
|
|
+@as_command("seaboardie")
|
|
|
+@as_command
|
|
|
+async def selfie(req: Request, logger: Logger, cmd: Command):
|
|
|
+ sector = SELFIE_SECTORS.get(cmd.raw_name.casefold(), "ne")
|
|
|
try:
|
|
|
async with req.get(
|
|
|
- "https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/eus/GEOCOLOR/latest.jpg"
|
|
|
+ f"https://cdn.star.nesdis.noaa.gov/GOES16/ABI/SECTOR/{sector}/GEOCOLOR/latest.jpg"
|
|
|
) as res:
|
|
|
res.raise_for_status()
|
|
|
return Attachment("image", await res.read())
|
|
|
except:
|
|
|
- logger.exception("Failed to call GOES16")
|
|
|
- RollbotFailure.SERVICE_DOWN.raise_exc(detail="Failed to call GOES16")
|
|
|
+ logger.exception(f"Failed to call GOES16 for sector {sector}")
|
|
|
+ RollbotFailure.SERVICE_DOWN.raise_exc(detail=f"Failed to call GOES16 for sector {sector}")
|
|
|
|
|
|
|
|
|
@as_command
|