简体   繁体   English

如何指定通道来设置权限?

[英]How to specify a channel to set permissions?

So I have a discord bot and I would like to add a ticketing system.所以我有一个 discord 机器人,我想添加一个票务系统。 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.我可以做await interaction.channel.set_permissions(N/A)channel function 将通道设置为发送的通道,我需要指定通道。 how can I do that?我怎样才能做到这一点?

To get a channel object for your specific channel you can do the following:要为您的特定频道获取频道 object,您可以执行以下操作:

bot.get_channel(int("YOUR_CHANNEL_ID"))

Your bot may be named differently (maybe client or something else), so just change this to whatever you need.您的机器人可能会以不同的方式命名(可能是客户端或其他名称),因此只需将其更改为您需要的任何名称。 Ex: something.get_channel()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM