Sending variable into functions without them showing up as an option in slash commands #963
-
I want to send a global variable into the namespace for the function, but not show it as an option for users. Here's a snippet of a subcommand: async def add(self, interaction: nextcord.Interaction, user: nextcord.Member, cursor=cursor):
How can i make it so that the |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
You could hold an attribute in your bot instance, so it can be accessed from |
Beta Was this translation helpful? Give feedback.
You could hold an attribute in your bot instance, so it can be accessed from
self
(assuming you set that attribute in your cog like the examples), orInteraction.client
. I would recommend storing the connection, and making a new cursor per transaction/operation too.