Discord bots help

Im following Code a Discord Bot with Python - Host for Free in the Cloud - YouTube , but its not working , can someone tell me why?

1 Like

I followed this Code a Discord Bot with Python - Host for Free in the Cloud - YouTube but it is not working , can someone tell me why


it seems a typo, but it’s usually much better if you post your code instead of a screenshot, or the link to your project. It’s easier to debug.

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 (’).

@python_newbie1 , All the code Is Grouped Together I Had The Same Problem But I Found A Way How To Do it! I Have Made A Fixed Version for you ;), https://replit.com/@Astrocricket/For-Python-Newbie#main.py - Astrocricket

@ilenia, I Think python_newbie1 Is Using Python

This is my code using the youtube video to learn to make a discord python bot.

It is not coming back with an error, just not “logging in as the bot” or showing online in the server. Hope somebody can help.

import discord
import os

client = discord.Client()

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

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

    if message.content.startswith('$Hello'):
      await message.channel.send('Hello!')

my_secret = os.environ['TOKEN']

If @ClashTournies If You Can Send Me A Link So I Can Find The Problem

you are missing the client.run() invocation

also careful with the two events, you have put them inside each other, the second one needs to be global, not nested in something else

thank you @rileyboy914 , I did notice it was python. A screenshot is still pretty difficult to debug sven with Python

there is also written “cilent” instead of “client”, so I stand with my “It seems a typo”

Yes, ilenila Is Correct

Yes thank You, I Am Still sorta A Noob At Python
But I Still Try Helping People

sorry where do I post this? I am following the video to learn python but unfortunately replit has changed their way of doing things so it throws out something different.

Any help is kindly appreciated.

Hey to add a qoute we use “def get_qoute” what do we use to add a picture in api ?

you can create your own topic for your own question

9 posts were split to a new topic: Having trouble with discord bot from python tutorial

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