I am trying to use nextcord to get all the choices from a user's inventory, but I am having trouble getting the user_id for my fetch_choices function. See below for some more details.
My slash command looks like this, (... is where I want userid):
async def duel(interaction: nextcord.Interaction, item: str = nextcord.SlashOption("item", choices=fetch_choices(...)), quantity: int = 1, side: str = "h"):
This is my fetch_choices code:
def fetch_choices(user_id):
c.execute("SELECT * FROM items WHERE user_id=?", (user_id,))
rows = c.fetchall()
items = {}
for row in rows:
item = row[1],
items.update({item[0]: item[0]})
return items
My question is how can I get the user id, and pass it to fetch_choices?
from Nextcord Dynamically Get Choices
No comments:
Post a Comment