discord_gleam/http/endpoints
Low-level functions for interacting with the Discord API.
Preferrably use the higher-level functions in src/discord_gleam.gleam.
Functions
pub fn ban_member(
token: String,
guild_id: String,
user_id: String,
reason: String,
) -> Result(Nil, DiscordError)
Ban a member from a server
pub fn create_dm_channel(
token: String,
user_id: String,
) -> Result(Channel, DiscordError)
Create a DM channel, can be used to send direct messages where a direct message function is not created
pub fn delete_message(
token: String,
channel_id: String,
message_id: String,
reason: String,
) -> Result(Nil, DiscordError)
Delete a message by channel id and message id
pub fn edit_message(
token: String,
channel_id: String,
message_id: String,
message: Message,
) -> Result(Nil, DiscordError)
Edit an message by channel id and message id
pub fn interaction_send_text(
interaction: InteractionCreatePacket,
message: String,
ephemeral: Bool,
) -> Result(Nil, DiscordError)
Send a basic text reply to an interaction
pub fn kick_member(
token: String,
guild_id: String,
user_id: String,
reason: String,
) -> Result(Nil, DiscordError)
Kick a member from a server
pub fn register_global_command(
token: String,
client_id: String,
command: SlashCommand,
) -> Result(Nil, DiscordError)
Register a new global slash command
pub fn register_guild_command(
token: String,
client_id: String,
guild_id: String,
command: SlashCommand,
) -> Result(Nil, DiscordError)
Register a new guild-specific slash command
pub fn reply(
token: String,
channel_id: String,
message: Reply,
) -> Result(Nil, DiscordError)
Reply to a message
pub fn send_direct_message(
token: String,
user_id: String,
message: Message,
) -> Result(Nil, DiscordError)
Creates a DM channel, then sends a message with send_message()
.
pub fn send_message(
token: String,
channel_id: String,
message: Message,
) -> Result(MessageSendResponse, DiscordError)
Send a message to a channel
pub fn wipe_global_commands(
token: String,
client_id: String,
) -> Result(Nil, DiscordError)
Wipes the global commands for the bot
pub fn wipe_guild_commands(
token: String,
client_id: String,
guild_id: String,
) -> Result(Nil, DiscordError)
Wipes the guild commands for the bot