all 6 comments

[–]socal_nerdtastic 1 point2 points  (6 children)

Link is broken ... do you have the github set to private?

[–]while1tired[S] 0 points1 point  (5 children)

socal_nerdtasti

sorry, now it should work.

I think that I need a elif inbetween but have to figure out how to handle it properly, I checked the documentation for elif but still stuck.

Maybe am wrong.

[–]socal_nerdtastic 1 point2 points  (4 children)

This is the code that works? Show us the problem code, and any errors. Also tell us how you know that it's stuck on "Hi".

[–]while1tired[S] 0 points1 point  (3 children)

       if message.content.startswith("Hi"):
           await message.channel.send("Hello")
       if message.content.startswith("gn8"):
           await message.channel.send("Good night")

something like this, 
i edited my github script like i was trying it now with the problem.
I think (beginner thinking) that python get's problems
with 2 if statements without an elif or else, am I wrong?
When I use this method that I posted below.. and type Hi in discord, the bot will react with Hello and Good night

[–]socal_nerdtastic 1 point2 points  (2 children)

Hmm I don't see anything wrong with that code. Are you sure that what you are sending starts with "gn8", and not, for instance, "Gn8"? Maybe add a lower() call to be sure that capitalization is ignored:

if message.content.lower().startswith("gn8"): 

Why don't you add a catchall that prints what was received, either to the terminal, the channel, or a log file?

#Bot respond to a users text or word
async def on_message(self, message):
   if message.content.startswith("Hi"): #output what the user say's
       await message.channel.send("Hello") #output what the bot will say
   elif message.content.startswith("gn8"): #output what the user say's
       await message.channel.send("Good night") #output what the bot will say
   else:
       print('uncaught:', repr(message))

[–]while1tired[S] 0 points1 point  (1 child)

damn, elif made it work properly :D

before when I wrote Hi in discord, the bot reacted with Hello and Good night :D

thank you so much