Skip to content

decode message flags#718

Open
lara-rium wants to merge 5 commits intoKraigie:masterfrom
lara-rium:message-flags
Open

decode message flags#718
lara-rium wants to merge 5 commits intoKraigie:masterfrom
lara-rium:message-flags

Conversation

@lara-rium
Copy link

closes #711

i looked at user flags impl and reflected those on message but some things may be missing. pls lmk upon review. also sorry ab the messy revert commits, forgot to create different branches for each pr

Copilot AI review requested due to automatic review settings March 3, 2026 18:02
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds support for exposing Discord message flags in Nostrum.Struct.Message and introduces a dedicated Nostrum.Struct.Message.Flags helper module to convert between the integer bitfield and a boolean-flag struct.

Changes:

  • Introduce Nostrum.Struct.Message.Flags with from_integer/1 and to_integer/1 helpers.
  • Add a :flags field (raw bitfield integer) to Nostrum.Struct.Message and attempt to cast it during to_struct/1 and update merges.
  • Add a message flags type to the struct typespecs.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.

File Description
lib/nostrum/struct/message/flags.ex New helper struct/module for converting message flags between bitfield integers and booleans.
lib/nostrum/struct/message.ex Adds :flags to the message struct and attempts to cast it during struct construction/updates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jchristgit jchristgit self-assigned this Mar 4, 2026
@jchristgit jchristgit self-requested a review March 4, 2026 19:23
Copy link
Collaborator

@jchristgit jchristgit left a comment

Choose a reason for hiding this comment

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

Thank you for the pull request!

Clanker comments are mostly fine, to be honest. I'm positively surprised. See my comments below.

We should think about whether we want the flags field in the Message to automatically be decoded. Right now, from my understanding, they are just being kept as-is.

Copy link
Author

@lara-rium lara-rium left a comment

Choose a reason for hiding this comment

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

this should resolve all the comments, pls let me know if i need further adjustments

@lara-rium
Copy link
Author

We should think about whether we want the flags field in the Message to automatically be decoded. Right now, from my understanding, they are just being kept as-is.

i just copied over from user, which also keeps it as it is. if we wanna discuss this i think we should do it in another issue cos it'd affect other flags as well. im also not very happy with this approach bc it involves copy/pasting the same to_integer and from_integer functions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

message flags aren't decoded

3 participants