Add way to update travel method
This commit is contained in:
parent
eb4364ce03
commit
e179e640a3
1 changed files with 24 additions and 1 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue