Ask coding questions

← Back to all posts
Script wont run and there is no errors
lpkratch1

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

my_secret = os.environ['TOKEN']

That's my code, no I didn't include my token sorry. My command wont run, like it says stop for 1 second and then it stops. Again no syntax errors or anything that would be an error. There is nothing that even pops up in the command prompt.
https://storage.googleapis.com/replit/images/1621174506735_476c7944959d834e2f78bba8252ec6df.png https://storage.googleapis.com/replit/images/1621174550691_0488dbc73780c5c20be9e90890716786.png

Voters
lpkratch1
Comments
hotnewtop
themining72

The script finished running as it never started the bot. Put:

client.run(my_secret)

at the end of your file to run the bot.

DynamicSquid

Hey @themining72, thanks for helping people out! However, I don't recommend putting "Please mark this as the answer if this helped" as it makes it seem like your begging for cycles. It's always better to let the poster decide for themselves :)

lpkratch1

Thx everyone for helping me, I already fixed it. Thx so much everyone. All I had to do was add a space in the getenv so it would be geten [email protected]

lpkratch1

Thx everyone for helping me, I already fixed it. Thx so much everyone. All I had to do was add a space in the getenv so it would be geten v @DynamicSquid