Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

577
Views
Discord.py error al intentar crear un canal privado

Quería hacer un canal privado cuando un usuario ejecuta un comando simple. El código está abajo:

 @client.command(name='start') async def createChannel(ctx): guild = ctx.guild member = ctx.author admin_role = get(guild.roles, name = "Admin") overwrites = { guild.default_role: discord.PermissionOverwrite(read_messages=False), member: discord.PermissionOverwrite(read_messages=True), admin_role: discord.PermissionOverwrite(read_messages=True) } try: channel = await guild.create_text_channel('{}_sentinel'.format(ctx.author), overwrites=overwrites) except: print("Error")

Rastreo completo:

 Ignoring exception in command start: Traceback (most recent call last): File "/Users/raveeshyadav/Raveesh/sentinel/sentinel/lib/python3.9/site-packages/discord/ext/commands/core.py", line 85, in wrapped ret = await coro(*args, **kwargs) File "/Users/raveeshyadav/Raveesh/sentinel/bot.py", line 44, in createChannel channel = await guild.create_text_channel('{}_sentinel'.format(ctx.author), overwrites=overwrites) File "/Users/raveeshyadav/Raveesh/sentinel/sentinel/lib/python3.9/site-packages/discord/guild.py", line 948, in create_text_channel data = await self._create_channel(name, overwrites, ChannelType.text, category, reason=reason, **options) File "/Users/raveeshyadav/Raveesh/sentinel/sentinel/lib/python3.9/site-packages/discord/guild.py", line 844, in _create_channel 'id': target.id AttributeError: 'NoneType' object has no attribute 'id' The above exception was the direct cause of the following exception: Traceback (most recent call last): File "/Users/raveeshyadav/Raveesh/sentinel/sentinel/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 939, in invoke await ctx.command.invoke(ctx) File "/Users/raveeshyadav/Raveesh/sentinel/sentinel/lib/python3.9/site-packages/discord/ext/commands/core.py", line 863, in invoke await injected(*ctx.args, **ctx.kwargs) File "/Users/raveeshyadav/Raveesh/sentinel/sentinel/lib/python3.9/site-packages/discord/ext/commands/core.py", line 94, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'NoneType' object has no attribute 'id'

Captura de pantalla:

Captura de pantalla de error

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Este error se genera al pasar una clave con un valor de None en overwrites . Probablemente sea admin_role . Puedes comprobar:

  • De hecho, tienes un rol llamado Admin en el gremio;
  • Ha activado las intenciones del gremio para que pueda tener la lista de roles.
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!