#๐Ÿ”’ Alignment error

99 messages ยท Page 1 of 1 (latest)

serene coralBOT
#

@lofty tree

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

lofty tree
#

C:\Desktop\Auto MM Bot>python main.py
File "C:\Users\Omari\Desktop\Tools\Auto MM Bot\main.py", line 179
else:
^
IndentationError: unindent does not match any outer indentation level

#
        # User is not found in any channel
        error_embed = discord.Embed(
            description=f'Error: User {user_id} is not found in any channel in the server.',
            color=discord.Color.red()
        )
        await channel.send(embed=error_embed)

     except asyncio.TimeoutError:
    timeout_embed = discord.Embed(
        description='Timed out. Please create a new ticket if you wish to try again.',
        color=discord.Color.red()
    )
    await channel.send(embed=timeout_embed)

@bot.command()
async def delete(ctx):
    if isinstance(ctx.channel, discord.TextChannel):
        await ctx.channel.delete()

bot.run(config.BOT_TOKEN)  # Using the token from config.py```
hard turret
#

I think

#

does this provide indentation error?

lofty tree
#

this the error it gives

hard turret
#

hmm

#

The indentation in your code seems to be inconsistent, leading to "IndentationError"

lofty tree
#

i tried to add buttons to my

#

discord auto mm bot

#

it got fucked

hard turret
#

this may be

#

oh yes, the except block and the @bot.command() decorator should be at the same indentation level

lofty tree
#

i went back in

#

to the code

#

to when it didnt have

hard turret
#

that's the reason for the error in code

lofty tree
#

so how do i fix it

hard turret
#

this is the reason

#

wait let me provide code

lofty tree
#

u want the code?

hard turret
#

yup

lofty tree
#
        # User is not found in any channel
        error_embed = discord.Embed(
            description=f'Error: User {user_id} is not found in any channel in the server.',
            color=discord.Color.red()
        )
        await channel.send(embed=error_embed)

except asyncio.TimeoutError:
    timeout_embed = discord.Embed(
        description='Timed out. Please create a new ticket if you wish to try again.',
        color=discord.Color.red()
    )
    await channel.send(embed=timeout_embed)

@bot.command()
async def delete(ctx):
    if isinstance(ctx.channel, discord.TextChannel):
        await ctx.channel.delete()

bot.run(config.BOT_TOKEN)  # Using the token from config.py
hard turret
#

else i won't be able to identify

lofty tree
#

would this be correct

hard turret
#

let me try my best

lofty tree
#

ok

#

wait

#

yeah

#

ok

hard turret
#

check if that works now

else:
    # User is not found in any channel
    error_embed = discord.Embed(
        description=f'Error: User {user_id} is not found in any channel in the server.',
        color=discord.Color.red()
    )
    await channel.send(embed=error_embed)

except asyncio.TimeoutError:
    timeout_embed = discord.Embed(
        description='Timed out. Please create a new ticket if you wish to try again.',
        color=discord.Color.red()
    )
    await channel.send(embed=timeout_embed)

@bot.command()
async def delete(ctx):
    if isinstance(ctx.channel, discord.TextChannel):
        await ctx.channel.delete()

bot.run(config.BOT_TOKEN)  # Using the token from config.py
lofty tree
#

File "C:\Users\Omari\Desktop\Tools\Auto MM Bot\main.py", line 179
else:
^
IndentationError: unindent does not match any outer indentation level

lofty tree
hard turret
#

does it work ?

bleak pond
#

for what, trading?

lofty tree
lofty tree
#

litecoin

#

crypto

hard turret
#

legit one?

lofty tree
#

yes

hard turret
#

or dummies?

lofty tree
#

legit

hard turret
#

nice bro

#

i want some too : )

lofty tree
#

thank u

lofty tree
#

help me finish the code

#

i dont mind giving it to you

#

too]

hard turret
#

yeah i will try best

bleak pond
lofty tree
#

basically

#

it has a api

#

that can receive and send ltc

hard turret
lofty tree
#

litecoin

#

and

#

after receiving the litecoin

#

it holds it

#

until the other trader

#

says he received the product

#

once he says he received the product

#

the bot releases the money

#

to the other trader that gave the product

lofty tree
#

so

#

can you help in any way

bleak pond
#

the way you pasted the code is incorrect so it's hard to help

#

you need to provide surrounding code too

#

!paste

serene coralBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

bleak pond
#

although indentation errors are something very basic to fix, so you might want to revisit the fundamentals

lofty tree
#

here

bleak pond
#

does your IDE have the collapse feature?

#

you can hide all the content of a block except the head of it

lofty tree
#

uhh

#

well

#

yes

#

it does

bleak pond
#

this will make it easier for you to figure out where you have went wrong

#

by hiding away parts that you know are right

lofty tree
#

oh damn thats hard tbh

#

ok its fixed

#

but

#

@bleak pond

#

how do i implement buttons in this code

bleak pond
#

No clue, I don't knows discord bots

serene coralBOT
#

Hey @lofty tree!

It looks like you pasted Python code without syntax highlighting.

Please use syntax highlighting to improve the legibility of your code and make it easier for us to help you.

To do this, use the following method:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
You can **edit your original message** to correct your code block.
lofty tree
#

discord.components doesnt work

#

no idea what the

#

nvm ok

serene coralBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.