Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Feat: Intent warning for events and prefixed commands #577

Merged
merged 4 commits into from
Aug 2, 2022

Conversation

Kigstn
Copy link
Member

@Kigstn Kigstn commented Jul 31, 2022

What type of pull request is this?

  • Non-breaking code change
  • Breaking code change
  • Documentation change/addition
  • Tests change

Description

This warns users if they use a gateway event / prefixed commands and do not have the required intents enabled. If users read their console output, this should make debugging easier for them.

Lists of intents and events taken from https://discord.com/developers/docs/topics/gateway#list-of-intents

Changes

  • warn when event is missing required intent
  • warn when prefixed commands are used but the message content intent is missing

Checklist

  • I've formatted my code with Black
  • I've ensured my code works on Python 3.10.x
  • I've tested my code

@LordOfPolls
Copy link
Member

I'd suggest using references to the event objects rather than strings. That way if we were to refactor they'd be caught by most modern IDEs

@Kigstn
Copy link
Member Author

Kigstn commented Jul 31, 2022

I'd suggest using references to the event objects rather than strings. That way if we were to refactor they'd be caught by most modern IDEs

Sure, good call

@AstreaTSS
Copy link
Contributor

Too lazy to do a proper review, but it should be noted that prefixed commands will work fine even without the message content intent unless they change the prefixes used to outside of their defaults (you can always mention the bot). Probably worth checking for that.

naff/client/client.py Outdated Show resolved Hide resolved
from naff.api.events import RawGatewayEvent, MessageCreate
from naff.api.events import processors
from naff.api.events.internal import Component, BaseEvent
from naff.api.events import MessageCreate, RawGatewayEvent, processors, Component, BaseEvent
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bonus points if you refactor all existing references to these to also use events., but I'm happy to merge without that

@silasary silasary merged commit b2e1857 into NAFTeam:dev Aug 2, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants