convert corona to a slash command

This commit is contained in:
Luke Robles 2022-10-25 11:43:25 -07:00
parent 00b0a03855
commit ee97fdf395
2 changed files with 16 additions and 6 deletions

View File

@ -4,7 +4,7 @@ RUN pip install --disable-pip-version-check --no-compile --no-cache-dir -q -r re
FROM python:3.8-slim FROM python:3.8-slim
RUN apt-get update && apt-get install -y --no-install-recommends imagemagick RUN apt-get update && apt-get install -y --no-install-recommends imagemagick
RUN pip install black RUN pip install black && echo "find . -name \"*sync-conflict*\" -delete; black .; ./bot.py" > /usr/local/bin/start && chmod +x /usr/local/bin/start
COPY --from=0 /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages COPY --from=0 /usr/local/lib/python3.8/site-packages /usr/local/lib/python3.8/site-packages
ADD app /app ADD app /app
WORKDIR /app WORKDIR /app

View File

@ -117,15 +117,25 @@ class ActualUtils(commands.Cog):
) )
await ctx.send(embed=embed) await ctx.send(embed=embed)
@commands.command(name="corona", aliases=["covid"]) @commands.slash_command(
async def corona(self, ctx: commands.Context, *, location=None): guild_ids=None,
name="corona",
description="Query Johns hopkins online covid stats. Requires a location",
)
@option(
name="location",
required=True,
description="The location you want to see covid stats for",
default="California",
)
async def corona(self, ctx: commands.Context, location):
import corona import corona
async with ctx.message.channel.typing(): await ctx.defer()
result = corona.parse_message(location) result = corona.parse_message(location)
await ctx.send(embed=result) await ctx.send_followup(embed=result)
@commands.slash_command( @commands.slash_command(
guld_ids=None, guld_ids=None,