(PYTHON) IndentationError: unindent does not match any outer indentation level 

import discord
import os
from discord.ext import commands
#import requests
#import json

client = commands.Bot(command_prefix = "--")
myEmbed = discord.Embed





@client.event
async def on_ready():
    print("\t\t\t\t\tLogged In As {0.user}".format(client))

@client.event
async def on_message(message):
  if message.author == client.user:
     return
  await client.process_commands(message)

@client.command(name = "owner")
async def owner(context):
  
    myEmbed = discord.Embed(title = "Owner Info" , description = "--------------------" , color = 0xff00)
    myEmbed.add_field(name ="Name", value = "qwerty")
    myEmbed.add_field(name = "Tag" , value = "#0123")
    myEmbed.set_author(name = "Friend Bot")
  
 await context.message.channel.send(embed = myEmbed)



client.run(os.getenv('ENCRYPT'))



The error hits at line : await message.channel.send(embed = myEmbed)

I can see from here that there is a space in front - remove that.
Also your indentation seems very inconsistent inbetween your functions.

1 Like

I still don’t get it. Please elaborate further and yes I will make my indents more consistent in the future.

indentation is an important part of python syntax, if it’s not made correctly the program will error out or just not work

I suggest you look up some Python syntax lessons before starting something as complex as a bot

I know of the importance of ndebtation. In this case , I just can’t figure where I went wrong.

that line has one space indentation, which doesn’t match any meaningful indentation level, so you get an error

…elaborate “what”? There is a space at the start of the line, that shouldn’t be there. I have no idea how to elaborate that any further.

@client.command(name = "owner")
async def owner(context):
  
    myEmbed = discord.Embed(title = "Owner Info" , description = "--------------------" , color = 0xff00)
    myEmbed.add_field(name ="Name", value = "qwerty")
    myEmbed.add_field(name = "Tag" , value = "#0123")
    myEmbed.set_author(name = "Friend Bot")
    
    await context.message.channel.send(embed = myEmbed)

Try to follow the PEP8 code guideline.

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.