【发布时间】:2022-01-15 21:28:36
【问题描述】:
我正在寻找一个个人不和谐机器人,版主将使用它来为特定用户创建频道。它将以“$create firstName lastName category user”的形式调用,哪个类别是创建频道的类别,user 是带有标签的用户的用户名。我已经设法让它创建频道,但我不知道如何为新创建的频道授予用户特定权限。这是我当前从命令创建频道的定义
@bot.command()
async def create(ctx, firstName, lastName, category, user):
print(ctx)
role = discord.utils.get(ctx.guild.roles, name="Moderator")
if role in ctx.author.roles:
cat = discord.utils.get(ctx.guild.categories, name=category)
await ctx.guild.create_text_channel(firstName + ' ' + lastName, category=cat)
#insert permission changes for user id: user id is the actual username and tag
else:
await ctx.send("You do not have permissions to create a channel. Only Moderators do")```
【问题讨论】: