Creating a Discord Bot Help

Hi!

I’m following this tutorial Code a Discord Bot with Python - by FreeCodeCamp.Org


to create a bot for Discord. I keep receiving this error when I type ‘$inspire’ and I am not sure what it means. If anyone could help or explain that would be much appreciated. I am using replit to code.

Inside get_quote function, after pulling response from the link, add a code print(response) to see what you are getting and if it has a text property.

Also move the link inside brackets to upper line just after get method, I don’t exactly know if it is an issue though. Not super confident about the syntax.

Hi @ImRanDan !

Welcome to the forum!

Screenshots are super hard to read.
It is always best to post your code directly into the forum.

Here is how to write code into the forum.

When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

Hey,

Thanks for the reply! I moved the brackets around and found out it was mostly syntax error. I don’t know what I did truly but it works now.

Greatly appreciate your help!

Hello,

Thanks for the warm welcome! I will keep this in mind the next time I post.

The issue here was how the function wasn’t called due to the calling parenthesis and the argument being in the next line

def get_quote():
  response = requests.get("https://zenquotes.io/api/random")

As a rule of thumb, whenever calling a function or a method that’s a function, it’s always best to ensure that your identifier(function name) is followed by a ( in the same line