-
Notifications
You must be signed in to change notification settings - Fork 29
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
messages: Support silent flag #161
Comments
I'm sorry for the delay. If I'm not wrong, the discord_create_message structure has a flag option. But we are indeed missing 2 flags: SUPPRESS_NOTIFICATIONS, the one you're looking, and IS_VOICE_MESSAGE. Soon I'll be creating a PR to add both. |
Hey. I'm sorry for the delay. I came with some updates. I'm developing a branch updating all codecs, |
Thanks! I took a look at that latest commit there, but I don't see anything related to this flag there. Do you mind pointing out where to look for that? Just want to look at what's added and then go ahead and add some code to interface with it. |
Sure! A tip is that anything related to the structs of Discord API responses will be found in Specifically, the flag you're searching is in api/channel.PRE.h, line 273 |
I tried it and it didn't appear to work, but I might have done something wrong, and I'm not sure if other stuff needs to be updated.
I looked at the documentation, and found this: https://cogmasters.github.io/concord/structdiscord__create__message.html#a3c7adafb00478f6e77360e428d2951c2
Is this still correct? Does that function need to be updated or does the documentation need to be updated? (I've also confirmed via HTTP debug that "flags" is 0 in the payload) |
It's properly install, the flag itself is available as the code compiles.
Hmm, well that's probably it, then I always set message_id to 0. I thought that was just to ensure it's not a reply in thread to something on Discord, per the docs? Am I missing something? I'm just trying to post normal messages.
Hmm, I'm only seeing one... would you mind elaborating? Thanks! |
Oh, I may have been a little superficial with my "won't have any effect" -- with that I mean you won't reference any message.
Yes, follow the JSON from the screenshot I sent you: {"id":"1202079666543013899","type":0,"content":"Hey!","channel_id":"1171670935691075614","author":{"id":"1038648927693590619","username":"PerformanC","avatar":"e56cb550dc19470d708f5e190620fcdc","discriminator":"0871","public_flags":0,"premium_type":0,"flags":0,"bot":true,"banner":null,"accent_color":null,"global_name":null,"avatar_decoration_data":null,"banner_color":null},"attachments":[],"embeds":[],"mentions":[],"mention_roles":[],"pinned":false,"mention_everyone":false,"tts":false,"timestamp":"2024-01-31T02:35:26.064000+00:00","edited_timestamp":null,"flags":4096,"components":[],"referenced_message":null} If we take to a JSON viewer, we can see there is a |
Ah, I see what you mean. Yeah, both those flags are 0 for me. Do you mind posting a code snippet you have that generated the result in the screenshot? I can probably work it out from there. |
I made a gist with the code -- I didn't change the position of where the flags is set, but you can built-in it to the struct |
Okay, it works! Typically user error, the code I thought was running was not actually the code that was running... It's working as expected and I'll leave this branch running and see if I notice anything strange, but looks good so far - thanks! |
Nice to hear, feel free to report any issue on its PR, #169. :) I'll keep this open till it's merged on dev |
Describe the feature
I use this library for an IRC relay (bot), and it would be helpful to be able to use the
@silent
feature that seems to exist now, particularly for IRC join/part/quit messages, to avoid notifying everyone on Discord when these events happen, as there are currently a lot of complaints about this.The message flag is documented here: https://github.com/discord/discord-api-docs/pull/5894/files
I confirmed by analyzing the network requests that the only different when using this feature is the flag is indeed set to 4096 (1 << 12), as opposed to 0, so this appears to be correct.
It appears that this would be the right place to add the flag: https://github.com/Cogmasters/concord/blob/master/gencodecs/api/channel.PRE.h#L30
I'm less certain about how the flag would be used. The only place I see any flags being used is here:
concord/examples/components.c
Line 195 in 769bdb7
However, I would think that flags would need to be provided in
create_message
, e.g. here:concord/src/channel.c
Line 220 in 769bdb7
Since I don't see this, would the ability to specify flags when sending a message need to be added as well, or is the other example the proper way to send messages if flags need to be added? I'm less sure about this, otherwise I think this should be a fairly straightforward addition.
The text was updated successfully, but these errors were encountered: