Improper token passed

slowpoking9 picture slowpoking9 · Jul 30, 2018 · Viewed 7.1k times · Source

I'm following a basic tutorial for a python discord bot on youtube and my code is underneath. it says an improper token has been passed. before anyone asks, yes i have put in the bot token not the id or secret

import discord
from discord.ext.commands import Bot
from discord.ext import commands
import asyncio
import time

Client = discord.Client()
client = commands.Bot(command_prefix = "!")

@client.event
async def on_ready():
    print("Bot is ready!")

@client.event
async def on_message(message):
    if message.content == "cookie":
        await client.send_message(message.channel, ":cookie:")

client.run("token is here")

Answer

Elyrith picture Elyrith · May 10, 2020

Make sure you grab the "Token" from the "Bot" page in the Discord development site, rather than the "Secret" from the "General Information" page.

I was having the same problem. My issue was solved by using the correct token from the Discord app page. I was using the "Secret" from the 'General Information' page (which generated the error in the original post for me) instead of the "Token" from the "Bot" page.

Edit: As sheneb said in the comment to this, this answer (probably) won't help the OP (since the question now says "before anyone asks, yes i have put in the bot token not the id or secret"). However, I found this question/page when searching for the answer, and my issue was solved with this info. I'm glad it helped you, gouravkr, and I hope it helps others who visit.