Python Discord Bot not Working

import discord

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 Idiot!')


client.run('ODIwNTQzMDM5MzQ5MDYzNjgw.YE2sQQ.dzTlI0ht9BqhA5_d-HeRkyqYOGA')

Unable to invite bot to my server.

I googled the error message, it says how to solve it
the error is not related to your code

You also leaked your API key, meaning anyone can copy-paste this, create their own bot with it and abuse the key.

I suggest you reset your API key and do not hard code it in your app (set it as an environment variable which you load). Or even if you hard-code it, don’t paste/redistribute it as its essentially the bots unique ID.

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