Ask coding questions

← Back to all posts
What is wrong with line 11
MahalaHala (0)

I really don't know what's wrong with line 11 please help

Answered by btfuss (177) [earned 5 cycles]
View Answer
Comments
hotnewtop
btfuss (177)

First of all, the function doesn't return anything. Second of all your if statement on line 14 has only 1 space, add another.

MahalaHala (0)

I keep trying to solve it and another line has a problem, the problem line 15
@btfuss

btfuss (177)

@MahalaHala
Here is the fixed code:

import os 

client = discord.Client()

@client.event
async def on_ready():
 print ('We have logged in as {0.user}'
  .format ( client ))


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

   if message.content.startswith("!h")
       await message.channel.send ('Whatcha want') 

client.run
my_secret = os.environ['!h']```

## To indent, use tab
MahalaHala (0)

it says line 17 is invalid

@btfuss

btfuss (177)

@MahalaHala Yeah I saw that it didn't work.
https://replit.com/@btfuss/fix#main.py
Tell me when you copied the code!

Also, I just saw the error. You haven't created an environment variable. You have to set them using this article: https://askubuntu.com/questions/58814/how-do-i-add-environment-variables

btfuss (177)

@MahalaHala If this worked, do you mind selecting yours truly and the answer?

im cycle hungry lol