Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intents wrong value #2195

Closed
3 tasks done
davidhozic opened this issue Aug 4, 2023 · 4 comments · Fixed by #2257
Closed
3 tasks done

Intents wrong value #2195

davidhozic opened this issue Aug 4, 2023 · 4 comments · Fixed by #2257
Labels
unconfirmed bug A bug report that needs triaging

Comments

@davidhozic
Copy link
Contributor

davidhozic commented Aug 4, 2023

Summary

When creating new intents from the old one, it seems their values are different.

Reproduction Steps

See code below.

Minimal Reproducible Code

import discord

intents = discord.Intents.default()

flags = {}
for attr in intents.VALID_FLAGS:
    flags[attr] = getattr(intents, attr)

new_intents = discord.Intents(**flags)

print(intents.value)
print(new_intents.value)

Expected Results

The printed values should be the same.

Actual Results

They are:

4161277
3243773

Intents

discord.Intents.default() used, no client used

System Information

  • Python v3.8.10-final
  • py-cord vNone.1.None-final
  • aiohttp v3.8.5
  • system info: Windows 10 10.0.19045

(PyCord is on master branch)

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

It's due to a gap between bit masks.
Bit masks without an assigned flag:

  • (1 << 17)
  • (1 << 18)
  • (1 << 19)

Since .all method just sets all the bits from the highest bit to the lowest, the unused bits also get set.

@davidhozic davidhozic added the unconfirmed bug A bug report that needs triaging label Aug 4, 2023
@davidhozic davidhozic changed the title Intents invalid value Intents wrong value Aug 4, 2023
@Aityz
Copy link
Contributor

Aityz commented Nov 8, 2023

Can I help fix this in Pycord's code.

@davidhozic
Copy link
Contributor Author

Can I help fix this in Pycord's code.

  1. Fork the PyCord repo
  2. Fix the bug in forked repo
  3. Update CHANGELOG.MD
  4. Open pull request from forked repo to PyCord repo, linking this issue

@Aityz
Copy link
Contributor

Aityz commented Nov 8, 2023

Thank you. I'm doing that right now.

@Aityz
Copy link
Contributor

Aityz commented Nov 8, 2023

Additional Context

It's due to a gap between bit masks. Bit masks without an assigned flag:

  • (1 << 17)
  • (1 << 18)
  • (1 << 19)

Since .all method just sets all the bits from the highest bit to the lowest, the unused bits also get set.

Ahhh, yes I understand what you mean. There is a gap in the intents exponents.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unconfirmed bug A bug report that needs triaging
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants