Add way to update travel method

This commit is contained in:
Zeva Rose 2022-10-16 19:33:11 -06:00
parent eb4364ce03
commit e179e640a3

View file

@ -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)