Why does my python discord bot not go online?

Viewed 42

I am using VS code, i followed a tutorial and this is what it gives me

code:

import discord

    token = "my token cuz security purposes"
    
    client = discord.Client()
    
    @client.event
    async def on_ready():
        print(f"logged in as {client.user}")
    
    client.run(token) 

terminal output:

    S C:\Users\User> & C:/Users/User/AppData/Local/Programs/Python/Python310/python.exe c:/Users/User/Lavabot.py
    Traceback (most recent call last):
      File "c:\Users\User\Lavabot.py", line 5, in <module>
        client = discord.Client()
    TypeError: Client.__init__() missing 1 required keyword-only argument: 'intents'
    PS C:\Users\User>

And yes, i did pip install discord. I added ''intentions'' to discord.Client(intentions), what now?

1 Answers

from the documentation:

intents (Intents) –

The intents that you want to enable for the session. This is a way of disabling and enabling certain gateway events from triggering and being sent.

New in version 1.5.

Changed in version 2.0: Parameter is now required.

add the intentions parameter to the discord.Client(intentions) call

more about intentions

Related