Get Channel Messages#

ORCAcode discord_get_channel_messages(struct discord *client, u64_snowflake_t channel_id, struct discord_get_channel_messages_params *params, struct discord_message ***ret)#

Get messages for a given channel.

Note

If operating on a guild channel, this endpoint requires the VIEW_CHANNEL permission to be present on the current user

Note

If the current user is missing the READ_MESSAGE_HISTORY permission in the channel then this will return no messages (since they cannot read the message history)

Note

The before, after, and around keys are mutually exclusive, only one may be passed at a time

Parameters:
  • client – the client created with discord_init()

  • channel_id – the channel to get messages from

  • params – request parameters

  • ret – if successful, a null-terminated list of discord_message, that should be free’d with discord_message_list_free()

Returns:

ORCAcode for how the operation went, ORCA_OK means nothing out of the ordinary

struct discord_get_channel_messages_params#

Methods

  • Initializer:

    • void discord_get_channel_messages_params_init(struct discord_get_channel_messages_params *)

  • Cleanup:

    • void discord_get_channel_messages_params_cleanup(struct discord_get_channel_messages_params *)

    • void discord_get_channel_messages_params_list_free(struct discord_get_channel_messages_params **)

  • JSON Decoder:

    • void discord_get_channel_messages_params_from_json(char *rbuf, size_t len, struct discord_get_channel_messages_params *)

    • void discord_get_channel_messages_params_list_from_json(char *rbuf, size_t len, struct discord_get_channel_messages_params ***)

  • JSON Encoder:

    • void discord_get_channel_messages_params_to_json(char *wbuf, size_t len, struct discord_get_channel_messages_params *)

    • void discord_get_channel_messages_params_list_to_json(char *wbuf, size_t len, struct discord_get_channel_messages_params **)

Public Members

u64_snowflake_t around#

get messages around this message ID

u64_snowflake_t before#

get messages before this message ID

u64_snowflake_t after#

get messages after this message ID

int limit#

max number of messages to return (1-100)