Print code line issue

When I use a print code line to show something on the console, it doesn’t show what I have it set to show.

Edit: I watched the tutorial on here about how to make a Discord bot, and followed through, (up to when it shows “We have logged in as Encourage Bot#0824”)

Hi, welcome. You need to show some code and more context, like what version of python, what terminal command are you typing, or I don’t think anyone can help.

Sorry for the late reply, here’s my current 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('$Hello'):
    await message.channel.send('Hello!')
        
client.run(os.getenv('TOKEN'))

The import discord is there too

Also, I’m using Replit

what do you see in the console?

Nothing shows up at all

My current code-

import discord
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('$Hello'):
    await message.channel.send('Hello!')
        

my_secret = os.environ['BOT_TOKEN']

you are not starting the client

How do I start it then?

with the run command
you had it before

I do click run, and it doesn’t do anything.

the client.run line

Doesn’t work

what’s your code now?

import discord
import os

client.run

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('$Hello'):
    await message.channel.send('Hello!')
        

my_secret = os.environ['BOT_TOKEN']

look back at the tutorial and see where client.run is used

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