'Why this error in discord.py api wish logging user?
import discord
import asyncio
# Retrieved from browser local storage
client = discord.Client()
@client.event
async def on_ready():
print(client.servers)
client.login('email', 'password')
** Error: TypeError: login() takes 2 positional arguments but 3 were given. I was given 2 arguments, but error..**
Solution 1:[1]
According to the discord.py documentation, the Client.login() function takes only one argument, and that is the bot's token (it used to take two, but the bot argument has been deprecated since version 1.7). Here's the reference.
So the correct version of your code would be:
import discord
import asyncio
# Retrieved from browser local storage
client = discord.Client()
@client.event
async def on_ready():
print(client.servers)
client.login('your-bot-token')
That should do the trick.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
