Answer the question
In order to leave comments, you need to log in
How to set permissions when creating discord py text channel?
Good day, I have a piece of code
class User(commands.Cog):
def __init__(self, client):
self.client = client
inter_client = InteractionClient(client)
@commands.command()
# ВЫВОД СООБЩЕНИЯ
async def verif(self, ctx):
emb = discord.Embed(title=f'{ctx.guild.name} - ЗАЯВКА НА БУСТЕРА!',
description =
f"""
Для подачи заявки на бустера, нажмите кнопку
""",
colour = 0x88ddff
)
emb.set_thumbnail(url = 'https://upload.wikimedia.org/wikipedia/commons/d/d3/Zxcursed.gif')
emb.set_author(name = 'Написать')
row = ActionRow(
Button(
style = ButtonStyle.red,
label = 'Написать',
custom_id = 'verif_button'
)
)
await ctx.send(embed = emb, components = [row])
# СОЗДАНИЕ ТЕКСТОВОГО КАНАЛА ПО НАЖАТИИ КНОПКИ
@commands.Cog.listener()
async def on_button_click(self, inter):
res = 'Тикет создан!' # вывод сообщение что человек получил тикет
letters = 'qwertyuiopasdfghjklzxcvbnm1234567890'
name1 = ''.join(random.choice(letters) for i in range(5))
guild = inter.guild
cat = discord.utils.get(inter.guild.categories, name="want be booster")
member = inter.author
if inter.component.id == "verif_button":
await guild.create_text_channel(f'╰】・tiket: {name1}', category=cat)
await inter.reply(res, ephemeral = True)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question