So I have a discord bot and I would like to add a ticketing system. I have the ticketing system I am just making a button for it. when you click the button it will allow you to talk on the channel. I can do await interaction.channel.set_permissions(N/A)
but the channel
function sets the channel to the one it was sent from, I need to specify the channel. how can I do that?
I allready have the channel saved in a varbile but I cant do this
channel = await interation.guild.create_text_channel(name="inverters passion", overwrites=Overwritse, reason=f"inverters passion")
channel1 = bot.get_channel(int(channel.id))
await interaction.channel1.set_permissions(N/A)
because It just dosent work. but if I use the property below ⬇️ It will work but as you can see it says"The channel the interaction was sent from" I need to specify the channel there.
CodePudding user response:
To get a channel object for your specific channel you can do the following:
channel = bot.get_channel(int("YOUR_CHANNEL_ID"))
You can get a channel's ID by having Developer Mode enabled on discord, and by right clicking a channel then clicking on "Copy ID".
Then, to set the permissions:
await channel.set_permissions(interaction.user, YOUR_PERMISSION)
Your bot may be named differently (maybe client or something else), so just change this to whatever you need. Ex: something.get_channel()