#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <assert.h>
void
print_usage(void)
{
printf(
"\n\nThis bot demonstrates how easy it is to fetch/delete invites\n"
"1. Type 'invite.get <invite_code>' to get a invite object from its "
"particular code\n"
"2. Type 'invite.delete <invite_code>' to delete a invite object by "
"its particular code\n"
"\nTYPE ANY KEY TO START BOT\n");
}
void
{
log_info(
"Invite-Bot succesfully connected to Discord as %s#%s!",
}
void
{
char text[256];
snprintf(text, sizeof(text), "Success: https://discord.gg/%s",
}
void
{
.
content =
"Couldn't perform operation."
};
}
void
{
.keep = event,
};
.with_expiration = true,
};
}
void
{
.keep = event,
};
}
int
main(int argc, char *argv[])
{
const char *config_file;
if (argc > 1)
config_file = argv[1];
else
config_file = "../config.json";
assert(NULL != client && "Could not initialize client");
print_usage();
fgetc(stdin);
}
CCORDcode ccord_global_init()
Initialize global shared-resources not API-specific.
void ccord_global_cleanup()
Cleanup global shared-resources.
Public functions and datatypes.
CCORDcode discord_create_message(struct discord *client, u64snowflake channel_id, struct discord_create_message *params, struct discord_ret_message *ret)
Post a message to a guild text or DM channel.
CCORDcode discord_delete_invite(struct discord *client, char *invite_code, struct discord_delete_invite *params, struct discord_ret_invite *ret)
Delete an invite.
CCORDcode discord_get_invite(struct discord *client, char *invite_code, struct discord_get_invite *params, struct discord_ret_invite *ret)
Get an invite for the given code.
void discord_cleanup(struct discord *client)
Free a Discord Client handle.
CCORDcode discord_run(struct discord *client)
Start a connection to the Discord Gateway.
struct discord * discord_config_init(const char config_file[])
Create a Discord Client handle by a config.json file.
void discord_set_prefix(struct discord *client, const char prefix[])
Set a mandatory prefix before commands.
void discord_set_on_command(struct discord *client, char *command, void(*callback)(struct discord *client, const struct discord_message *event))
Set command/callback pair.
void discord_set_on_ready(struct discord *client, void(*callback)(struct discord *client, const struct discord_ready *event))
Triggers when the client session is ready.
#define log_info(...)
Definition: log.h:52
Definition: channel.h:683
char * content
Definition: channel.h:685
char * reason
Definition: invite.h:119
bool with_counts
Definition: invite.h:109
char * code
Definition: invite.h:29
Definition: channel.h:195
char * content
Definition: channel.h:207
struct discord_user * author
Definition: channel.h:203
Definition: gateway.h:332
struct discord_user * user
Definition: gateway.h:336
The response for the completed request.
Definition: discord-response.h:12
const void * keep
Definition: discord-response.h:16
Request's return context.
Definition: discord-response.h:132
void(* done)(struct discord *client, struct discord_response *resp, const struct discord_invite *ret)
Definition: discord-response.h:132
void(* fail)(struct discord *client, struct discord_response *resp)
Definition: discord-response.h:132
bool bot
Definition: user.h:79
char * username
Definition: user.h:73
char * discriminator
Definition: user.h:75
The Discord client handler.
Definition: discord-internal.h:1182