dolfies / discord.py-self

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

AttributeError: module 'discord' has no attribute 'Intents' #397

Closed BoQsc closed 1 year ago

BoQsc commented 1 year ago

Summary

on_ready seemed to not work, I think that's due to no intents declared. Discord Intents seems to not be supported by discord.py-self (is discord.py-self outdated?)

Reproduction Steps

https://discordpy.readthedocs.io/en/latest/intents.html#where-d-my-members-go

The below example works only when these lines are removed:

intents = discord.Intents.default()
intents.members = True

Else you receive error like this:

C:\Users\Windows10\Downloads\Disboard-Auto-Bumper-master\Disboard-Auto-Bumper-master>python 🌌bumper.py
Traceback (most recent call last):
  File "C:\Users\Windows10\Downloads\Disboard-Auto-Bumper-master\Disboard-Auto-Bumper-master\🌌bumper.py", line 2, in <module>
    intents = discord.Intents.default()
AttributeError: module 'discord' has no attribute 'Intents'

Code

import discord
intents = discord.Intents.default()
intents.members = True

class MyClient(discord.Client):
    async def on_ready(self):
        print('Logged on as', self.user)

    async def on_message(self, message):
        # only respond to ourselves
        if message.author != self.user:
            return

        if message.content == 'ping':
            await message.channel.send('pong')

client = MyClient()
client.run('token')
# pip uninstall discord.py

Expected Results

No error messages.

Actual Results

C:\Users\Windows10\Downloads\Disboard-Auto-Bumper-master\Disboard-Auto-Bumper-master>python 🌌bumper.py
Traceback (most recent call last):
  File "C:\Users\Windows10\Downloads\Disboard-Auto-Bumper-master\Disboard-Auto-Bumper-master\🌌bumper.py", line 2, in <module>
    intents = discord.Intents.default()
AttributeError: module 'discord' has no attribute 'Intents'

System Information

C:\Users\Windows10\Downloads\Disboard-Auto-Bumper-master\Disboard-Auto-Bumper-master>python -m discord -v

Checklist

Additional Information

No response

rhidwan commented 1 year ago

The intent was implemented in upgraded version of discord.py. It wont work well with this version. But it works well without the intent.

JU5TDIE commented 1 year ago

You don't need intents for discord.py-self and your discord.py-self is outdated. Update it by pip install git+https://github.com/dolfies/discord.py-self.git