From e179e640a352c917df27bf8761c8012f92a5aee7 Mon Sep 17 00:00:00 2001 From: Zevaryx Date: Sun, 16 Oct 2022 19:33:11 -0600 Subject: [PATCH] Add way to update travel method --- jarvis/cogs/ltx.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/jarvis/cogs/ltx.py b/jarvis/cogs/ltx.py index 7b09cc8..2c36c74 100644 --- a/jarvis/cogs/ltx.py +++ b/jarvis/cogs/ltx.py @@ -11,6 +11,7 @@ from naff.models.discord.user import Member from naff.models.naff.application_commands import ( OptionTypes, SlashCommand, + SlashCommandChoice, slash_option, ) @@ -269,5 +270,27 @@ class EventCog(Extension): await ctx.send(embeds=embed) -def setup(client): + @ltx.subcommand(sub_cmd_name="method", sub_cmd_description="Travel Method") + @slash_option( + name="method", + description="Travel Method", + opt_type=OptionTypes.STRING, + choices=[ + SlashCommandChoice(name="Flying", value="flying"), + SlashCommandChoice(name="Driving", value="driving"), + ], + ) + async def _ltx_method(self, ctx: InteractionContext, method: str) -> None: + event = await Event.find_one(q(user=ctx.author.id, event_name="ltx")) + if not event: + await ctx.send("You havent registered registered", ephemeral=True) + return + + event.travel_method = method + await event.commit() + await ctx.send(f"You're travelling by {method}", ephemeral=True) + + +def setup(client: Client) -> None: + """Add EventCog""" EventCog(client)