Whatic
Whatic

Reputation: 11

Discord bot is not running for some reason CLOSED

I need help with my bot, I coded it all before but then something happened and I made a new one and it just isn’t working when I run the code it works fine but the bot isn’t online or responding to the commands

import discord 
from keep_alive import keep_alive 

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('$cmds'): 

await message.channel.send("Hello! how are you, my current commands are $cmds and $ping more coming soon!") keep_alive() client.run(os.getenv("Token"))

enter image description here

[enter image description here][2]

[2]: https://i.sstatic.net/URmvr.jpg![enter image description here](https://i.sstatic.net/ei20c.jpg)

Upvotes: 0

Views: 612

Answers (1)

ChaoticNebula
ChaoticNebula

Reputation: 263

It is recommended that you use the commands framework :-

import discord
from discord.ext import commands

@client.command()
async def cmds(ctx):
  await ctx.send("Hello! how are you, my current commands are $cmds and $ping more coming soon!")

Upvotes: 0

Related Questions