dolfies / discord.py-self

A fork of the popular discord.py for user accounts.
https://discordpy-self.rtfd.io/en/latest/
MIT License
718 stars 164 forks source link

improper token passed #30

Closed chetan17289 closed 3 years ago

chetan17289 commented 3 years ago

everything is correct I have rechecked the bot token 20 @times

File "/app/.heroku/python/lib/python3.9/site-packages/discord/http.py", line 303, in static_login 2021-06-06T14:43:10.968122+00:00 app[worker.1]: raise LoginFailure('Improper token has been passed.') from exc 2021-06-06T14:43:10.968122+00:00 app[worker.1]: discord.errors.LoginFailure: Improper token has been passed.

caiocinel commented 3 years ago

everything is correct I have rechecked the bot token 20 @times

File "/app/.heroku/python/lib/python3.9/site-packages/discord/http.py", line 303, in static_login 2021-06-06T14:43:10.968122+00:00 app[worker.1]: raise LoginFailure('Improper token has been passed.') from exc 2021-06-06T14:43:10.968122+00:00 app[worker.1]: discord.errors.LoginFailure: Improper token has been passed.

Token must be exclusively from a user account, BOT tokens are not supported.

See more in #23

chetan17289 commented 3 years ago

If I want to use both bot and selfbot how can I use any solution?

riccardolunardi commented 3 years ago

If I want to use both bot and selfbot how can I use any solution?

Since the module name is the same, you could run 2 different python files in 2 different virtual enviroments

chetan17289 commented 3 years ago

If I want to use both bot and selfbot how can I use any solution?

Since the module name is the same, you could run 2 different python files in 2 different virtual enviroments

Bro I want to make crowd ans bot can I?

caiocinel commented 3 years ago

If I want to use both bot and selfbot how can I use any solution?

Since the module name is the same, you could run 2 different python files in 2 different virtual enviroments

Bro I want to make crowd ans bot can I?

https://github.com/Rapptz/discord.py/issues/516

If you really want to do this, I would recommend you use discum, which has built-in support for this.

dolfies commented 3 years ago

If you would like to create multiple bots you can do something like this

import asyncio
import discord
from collections import namedtuple

loop = asyncio.get_event_loop()
entry = namedtuple("entry", "client, token")

accounts = [entry(discord.Client(), token) for token in tokens]  # List of tokens)

async def login(account):
    try:
        await account.client.start(account.token)
    finally:
        await account.client.close()

running_bots= []
for a in accounts:
    running_bots.append(loop.create_task(login(a)))
loop.run_forever()

I haven't changed the project name as I wanted to retain backwards-compatibility as much as possible, especially with closed-source bots where you can't change import discord to import x as discord. You can use Python virtualenvs so this fork doesn't interfere with the original.

FeelsBadMan1 commented 3 years ago

Same issure here. I used a usertoken and the issure is still happening

caiocinel commented 3 years ago

Try to check if your token is really valid using requests or something like that, me and another friend are using the library normally.

https://github.com/caiocinel/Selfium/blob/1549e1ed374e7c4bf492573fdd59c02f83a73dec/app/auth/parse.py#L4

dolfies commented 3 years ago

Same issure here. I used a usertoken and the issure is still happening

What version of the library are you using? Latest PyPi release? Have you cloned a branch?

FeelsBadMan1 commented 3 years ago

Same issure here. I used a usertoken and the issure is still happening

What version of the library are you using? Latest PyPi release? Have you cloned a branch?

Im using the newest version. i installed it directly from pypi so it is the latest release. maybe other libs like discord.py slashcommands causing this issure because maybe pycharm select them instead of discord.py-self. if so it woul d be great, if anyone can reply me how i can set what module a single project should use.

caiocinel commented 3 years ago

Try development branch https://github.com/dolfies/discord.py-self/tree/development