Created
January 31, 2024 02:52
-
-
Save ThePedroo/c820dc88de408f317eb499df556e98c0 to your computer and use it in GitHub Desktop.
Concord suppress notification example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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, ¶ms, 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