W
W
Wolf_Yout2022-01-03 18:00:03
Python
Wolf_Yout, 2022-01-03 18:00:03

Where are the extra tabs / spaces, or what is this mistake?

The code:

@bot.command(name='ticket')
async def _ticket(ctx, number=None):
  if not number:
    return await ctx.reply(embed=discord.Embed(title="А какая тема тикета то?",description="Все тикеты:\n1-Набор на модератора\n2-Другая причина(Когда канал будет создан, вы должны указать тему)"))
  if number == "1":
    cat = discord.utils.get(ctx.guild.categories, name="tickets")
    channel = await ctx.guild.create_text_channel(f"ticket-{ctx.author.name}", category=cat)
    await channel.send(f"{ctx.author.mention} Тикет создан!")
        await channel.set_permissions(ctx.author, speak=True, send_messages=True, read_message_history=True, read_messages=True)
    return await ctx.message.delete()
  if number == "2":
    cat = discord.utils.get(ctx.guild.categories, name="tickets")
    channel = await ctx.guild.create_text_channel(f"ticket-{ctx.author.name}", category=cat)
    await channel.send(f"{ctx.author.mention} Укажи тему тикета!")
        await channel.set_permissions(ctx.author, speak=True, send_messages=True, read_message_history=True, read_messages=True)
    return await ctx.message.delete()
  else:
    return await ctx.reply(embed=discord.Embed(title="А какая тема тикета то?",description="Все тикеты:\n1-Набор на модератора\n2-Другая причина(Когда канал будет создан, вы должны указать тему)"))

Mistake:
C:\Users\shits>cd Desktop

C:\Users\shits\Desktop>python Ticki_bot.py
  File "C:\Users\shits\Desktop\Ticki_bot.py", line 14
    await channel.set_permissions(ctx.author,
TabError: inconsistent use of tabs and spaces in indentation

C:\Users\shits\Desktop>python Ticki_bot.py
  File "C:\Users\shits\Desktop\Ticki_bot.py", line 14
    await channel.set_permissions(ctx.author,
TabError: inconsistent use of tabs and spaces in indentation

C:\Users\shits\Desktop>python Ticki_bot.py
  File "C:\Users\shits\Desktop\Ticki_bot.py", line 14
    await channel.set_permissions(ctx.author, speak=True, send_messages=True, read_message_history=True, read_messages=True)
TabError: inconsistent use of tabs and spaces in indentation

C:\Users\shits\Desktop>python Ticki_bot.py
  File "C:\Users\shits\Desktop\Ticki_bot.py", line 14
    await channel.set_permissions(ctx.author, speak=True, send_messages=True, read_message_history=True, read_messages=True)
TabError: inconsistent use of tabs and spaces in indentation

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alan Gibizov, 2022-01-03
@Wolf_Yout

You cannot use tabs and spaces at the same time. Where are they - he writes to you, in line 14. And by the way, even in the 8th.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question