-1

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?

Lava
  • 11
  • 3
  • You need to specify the necessary intents. I'd prefer using `discord.Intents.all()` as it gives you access to all intents ***if you've enabled them on*** [***your Discord Developer Portal***](https://discord.com/developers/applications): `intents = discord.Intents.all() client = discord.Client(intents=intents)` Also, I'd suggest using [`discord.ext.commands.Bot`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#bots) instead as it has more features. See https://stackoverflow.com/questions/51234778/what-are-the-differences-between-bot-and-client. – The Amateur Coder Sep 11 '22 at 13:24
  • Does this answer your question? [Client.\_\_init\_\_() missing 1 required keyword-only argument: 'intents'](https://stackoverflow.com/questions/71959420/client-init-missing-1-required-keyword-only-argument-intents) – TheFungusAmongUs Sep 11 '22 at 14:41

1 Answers1

0

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

Almog-at-Nailo
  • 1,152
  • 1
  • 4
  • 20
  • What now? this just popped up with ''Intentions'' is not defined – Lava Sep 11 '22 at 12:36
  • Did you read the documentation? I provided some links you might be interested in. [This might help as well](https://discordpy.readthedocs.io/en/stable/intents.html) – Almog-at-Nailo Sep 11 '22 at 13:00
  • @Lava, Almog probably meant something like `intents = discord.Intents.all() client = discord.Client(intents=intents)` Also, I'd suggest using [`discord.ext.commands.Bot`](https://discordpy.readthedocs.io/en/stable/ext/commands/api.html#bots) instead as it has more features. See https://stackoverflow.com/questions/51234778/what-are-the-differences-between-bot-and-client. – The Amateur Coder Sep 11 '22 at 13:22