Skip to content

Instantly share code, notes, and snippets.

@ThePedroo
Created January 31, 2024 02:52
Show Gist options
  • Save ThePedroo/c820dc88de408f317eb499df556e98c0 to your computer and use it in GitHub Desktop.
Save ThePedroo/c820dc88de408f317eb499df556e98c0 to your computer and use it in GitHub Desktop.
Concord suppress notification example
#include <string.h>
#include <concord/discord.h>
#include <concord/log.h>
void on_message(struct discord *client, const struct discord_message *message) {
if (message->author->bot) return;
if (strcmp(".concord-test", message->content) == 0) {
struct discord_create_message params = {
.content = "Hey!",
.message_reference = &(struct discord_message_reference) {
.message_id = 0,
.channel_id = message->channel_id,
.guild_id = message->guild_id,
.fail_if_not_exists = false,
},
.components = NULL,
};
params.flags = DISCORD_MESSAGE_SUPPRESS_NOTIFICATIONS;
discord_create_message(client, message->channel_id, &params, NULL);
}
}
int main(void) {
struct discord *client = discord_config_init("config.json");
discord_set_on_message_create(client, &on_message);
discord_add_intents(client, DISCORD_GATEWAY_MESSAGE_CONTENT);
discord_run(client);
discord_cleanup(client);
ccord_global_cleanup();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment