class Discord::Client
- Discord::Client
- Reference
- Object
Overview
The basic client class that is used to connect to Discord, send REST requests, or send or receive gateway messages. It is required for doing any sort of interaction with Discord.
A new simple client that does nothing yet can be created like this:
client = Discord::Client.new(token: "Bot token", client_id: 123_u64)
With this client, REST requests can now be sent. (See the Discord::REST
module.) A gateway connection can also be started using the #run
method.
Included Modules
- Discord::REST
Defined in:
lib/discordcr/src/discordcr/client.crdiscordcr-middleware.cr
Instance Method Summary
-
#on_channel_create(*middleware)
Creates a
Client#on_channel_create
handler with a middleware chain. -
#on_channel_create(*middleware, &block : Channel, Context -> )
Creates a
Client#on_channel_create
handler with a middleware chain and trailing block. -
#on_channel_delete(*middleware, &block : Channel, Context -> )
Creates a
Client#on_channel_delete
handler with a middleware chain and trailing block. -
#on_channel_delete(*middleware)
Creates a
Client#on_channel_delete
handler with a middleware chain. -
#on_channel_update(*middleware)
Creates a
Client#on_channel_update
handler with a middleware chain. -
#on_channel_update(*middleware, &block : Channel, Context -> )
Creates a
Client#on_channel_update
handler with a middleware chain and trailing block. -
#on_dispatch(*middleware, &block : ::Tuple(String, IO::Memory), Context -> )
Creates a
Client#on_dispatch
handler with a middleware chain and trailing block. -
#on_dispatch(*middleware)
Creates a
Client#on_dispatch
handler with a middleware chain. -
#on_guild_ban_add(*middleware, &block : Gateway::GuildBanPayload, Context -> )
Creates a
Client#on_guild_ban_add
handler with a middleware chain and trailing block. -
#on_guild_ban_add(*middleware)
Creates a
Client#on_guild_ban_add
handler with a middleware chain. -
#on_guild_ban_remove(*middleware)
Creates a
Client#on_guild_ban_remove
handler with a middleware chain. -
#on_guild_ban_remove(*middleware, &block : Gateway::GuildBanPayload, Context -> )
Creates a
Client#on_guild_ban_remove
handler with a middleware chain and trailing block. -
#on_guild_create(*middleware, &block : Gateway::GuildCreatePayload, Context -> )
Creates a
Client#on_guild_create
handler with a middleware chain and trailing block. -
#on_guild_create(*middleware)
Creates a
Client#on_guild_create
handler with a middleware chain. -
#on_guild_delete(*middleware, &block : Gateway::GuildDeletePayload, Context -> )
Creates a
Client#on_guild_delete
handler with a middleware chain and trailing block. -
#on_guild_delete(*middleware)
Creates a
Client#on_guild_delete
handler with a middleware chain. -
#on_guild_emoji_update(*middleware)
Creates a
Client#on_guild_emoji_update
handler with a middleware chain. -
#on_guild_emoji_update(*middleware, &block : Gateway::GuildEmojiUpdatePayload, Context -> )
Creates a
Client#on_guild_emoji_update
handler with a middleware chain and trailing block. -
#on_guild_integrations_update(*middleware, &block : Gateway::GuildIntegrationsUpdatePayload, Context -> )
Creates a
Client#on_guild_integrations_update
handler with a middleware chain and trailing block. -
#on_guild_integrations_update(*middleware)
Creates a
Client#on_guild_integrations_update
handler with a middleware chain. -
#on_guild_member_add(*middleware, &block : Gateway::GuildMemberAddPayload, Context -> )
Creates a
Client#on_guild_member_add
handler with a middleware chain and trailing block. -
#on_guild_member_add(*middleware)
Creates a
Client#on_guild_member_add
handler with a middleware chain. -
#on_guild_member_remove(*middleware, &block : Gateway::GuildMemberRemovePayload, Context -> )
Creates a
Client#on_guild_member_remove
handler with a middleware chain and trailing block. -
#on_guild_member_remove(*middleware)
Creates a
Client#on_guild_member_remove
handler with a middleware chain. -
#on_guild_member_update(*middleware, &block : Gateway::GuildMemberUpdatePayload, Context -> )
Creates a
Client#on_guild_member_update
handler with a middleware chain and trailing block. -
#on_guild_member_update(*middleware)
Creates a
Client#on_guild_member_update
handler with a middleware chain. -
#on_guild_members_chunk(*middleware, &block : Gateway::GuildMembersChunkPayload, Context -> )
Creates a
Client#on_guild_members_chunk
handler with a middleware chain and trailing block. -
#on_guild_members_chunk(*middleware)
Creates a
Client#on_guild_members_chunk
handler with a middleware chain. -
#on_guild_role_create(*middleware)
Creates a
Client#on_guild_role_create
handler with a middleware chain. -
#on_guild_role_create(*middleware, &block : Gateway::GuildRolePayload, Context -> )
Creates a
Client#on_guild_role_create
handler with a middleware chain and trailing block. -
#on_guild_role_delete(*middleware)
Creates a
Client#on_guild_role_delete
handler with a middleware chain. -
#on_guild_role_delete(*middleware, &block : Gateway::GuildRoleDeletePayload, Context -> )
Creates a
Client#on_guild_role_delete
handler with a middleware chain and trailing block. -
#on_guild_role_update(*middleware)
Creates a
Client#on_guild_role_update
handler with a middleware chain. -
#on_guild_role_update(*middleware, &block : Gateway::GuildRolePayload, Context -> )
Creates a
Client#on_guild_role_update
handler with a middleware chain and trailing block. -
#on_guild_update(*middleware)
Creates a
Client#on_guild_update
handler with a middleware chain. -
#on_guild_update(*middleware, &block : Guild, Context -> )
Creates a
Client#on_guild_update
handler with a middleware chain and trailing block. -
#on_message_create(*middleware, &block : Message, Context -> )
Creates a
Client#on_message_create
handler with a middleware chain and trailing block. -
#on_message_create(*middleware)
Creates a
Client#on_message_create
handler with a middleware chain. -
#on_message_delete(*middleware, &block : Gateway::MessageDeletePayload, Context -> )
Creates a
Client#on_message_delete
handler with a middleware chain and trailing block. -
#on_message_delete(*middleware)
Creates a
Client#on_message_delete
handler with a middleware chain. -
#on_message_delete_bulk(*middleware, &block : Gateway::MessageDeleteBulkPayload, Context -> )
Creates a
Client#on_message_delete_bulk
handler with a middleware chain and trailing block. -
#on_message_delete_bulk(*middleware)
Creates a
Client#on_message_delete_bulk
handler with a middleware chain. -
#on_message_reaction_add(*middleware, &block : Gateway::MessageReactionPayload, Context -> )
Creates a
Client#on_message_reaction_add
handler with a middleware chain and trailing block. -
#on_message_reaction_add(*middleware)
Creates a
Client#on_message_reaction_add
handler with a middleware chain. -
#on_message_reaction_remove(*middleware, &block : Gateway::MessageReactionPayload, Context -> )
Creates a
Client#on_message_reaction_remove
handler with a middleware chain and trailing block. -
#on_message_reaction_remove(*middleware)
Creates a
Client#on_message_reaction_remove
handler with a middleware chain. -
#on_message_reaction_remove_all(*middleware)
Creates a
Client#on_message_reaction_remove_all
handler with a middleware chain. -
#on_message_reaction_remove_all(*middleware, &block : Gateway::MessageReactionRemoveAllPayload, Context -> )
Creates a
Client#on_message_reaction_remove_all
handler with a middleware chain and trailing block. -
#on_message_update(*middleware, &block : Gateway::MessageUpdatePayload, Context -> )
Creates a
Client#on_message_update
handler with a middleware chain and trailing block. -
#on_message_update(*middleware)
Creates a
Client#on_message_update
handler with a middleware chain. -
#on_presence_update(*middleware)
Creates a
Client#on_presence_update
handler with a middleware chain. -
#on_presence_update(*middleware, &block : Gateway::PresenceUpdatePayload, Context -> )
Creates a
Client#on_presence_update
handler with a middleware chain and trailing block. -
#on_ready(*middleware)
Creates a
Client#on_ready
handler with a middleware chain. -
#on_ready(*middleware, &block : Gateway::ReadyPayload, Context -> )
Creates a
Client#on_ready
handler with a middleware chain and trailing block. -
#on_resumed(*middleware, &block : Gateway::ResumedPayload, Context -> )
Creates a
Client#on_resumed
handler with a middleware chain and trailing block. -
#on_resumed(*middleware)
Creates a
Client#on_resumed
handler with a middleware chain. -
#on_typing_start(*middleware, &block : Gateway::TypingStartPayload, Context -> )
Creates a
Client#on_typing_start
handler with a middleware chain and trailing block. -
#on_typing_start(*middleware)
Creates a
Client#on_typing_start
handler with a middleware chain. -
#on_user_update(*middleware, &block : User, Context -> )
Creates a
Client#on_user_update
handler with a middleware chain and trailing block. -
#on_user_update(*middleware)
Creates a
Client#on_user_update
handler with a middleware chain. -
#on_voice_server_update(*middleware, &block : Gateway::VoiceServerUpdatePayload, Context -> )
Creates a
Client#on_voice_server_update
handler with a middleware chain and trailing block. -
#on_voice_server_update(*middleware)
Creates a
Client#on_voice_server_update
handler with a middleware chain. -
#on_voice_state_update(*middleware, &block : VoiceState, Context -> )
Creates a
Client#on_voice_state_update
handler with a middleware chain and trailing block. -
#on_voice_state_update(*middleware)
Creates a
Client#on_voice_state_update
handler with a middleware chain.
Macro Summary
Instance Method Detail
Creates a Client#on_channel_create
handler with a middleware chain.
Handles a Channel
payload.
Creates a Client#on_channel_create
handler with a middleware chain and
trailing block. Handles a Channel
payload.
Creates a Client#on_channel_delete
handler with a middleware chain and
trailing block. Handles a Channel
payload.
Creates a Client#on_channel_delete
handler with a middleware chain.
Handles a Channel
payload.
Creates a Client#on_channel_update
handler with a middleware chain.
Handles a Channel
payload.
Creates a Client#on_channel_update
handler with a middleware chain and
trailing block. Handles a Channel
payload.
Creates a Client#on_dispatch
handler with a middleware chain and
trailing block. Handles a {String, IO::Memory}
payload.
Creates a Client#on_dispatch
handler with a middleware chain.
Handles a {String, IO::Memory}
payload.
Creates a Client#on_guild_ban_add
handler with a middleware chain and
trailing block. Handles a Gateway::GuildBanPayload
payload.
Creates a Client#on_guild_ban_add
handler with a middleware chain.
Handles a Gateway::GuildBanPayload
payload.
Creates a Client#on_guild_ban_remove
handler with a middleware chain.
Handles a Gateway::GuildBanPayload
payload.
Creates a Client#on_guild_ban_remove
handler with a middleware chain and
trailing block. Handles a Gateway::GuildBanPayload
payload.
Creates a Client#on_guild_create
handler with a middleware chain and
trailing block. Handles a Gateway::GuildCreatePayload
payload.
Creates a Client#on_guild_create
handler with a middleware chain.
Handles a Gateway::GuildCreatePayload
payload.
Creates a Client#on_guild_delete
handler with a middleware chain and
trailing block. Handles a Gateway::GuildDeletePayload
payload.
Creates a Client#on_guild_delete
handler with a middleware chain.
Handles a Gateway::GuildDeletePayload
payload.
Creates a Client#on_guild_emoji_update
handler with a middleware chain.
Handles a Gateway::GuildEmojiUpdatePayload
payload.
Creates a Client#on_guild_emoji_update
handler with a middleware chain and
trailing block. Handles a Gateway::GuildEmojiUpdatePayload
payload.
Creates a Client#on_guild_integrations_update
handler with a middleware chain and
trailing block. Handles a Gateway::GuildIntegrationsUpdatePayload
payload.
Creates a Client#on_guild_integrations_update
handler with a middleware chain.
Handles a Gateway::GuildIntegrationsUpdatePayload
payload.
Creates a Client#on_guild_member_add
handler with a middleware chain and
trailing block. Handles a Gateway::GuildMemberAddPayload
payload.
Creates a Client#on_guild_member_add
handler with a middleware chain.
Handles a Gateway::GuildMemberAddPayload
payload.
Creates a Client#on_guild_member_remove
handler with a middleware chain and
trailing block. Handles a Gateway::GuildMemberRemovePayload
payload.
Creates a Client#on_guild_member_remove
handler with a middleware chain.
Handles a Gateway::GuildMemberRemovePayload
payload.
Creates a Client#on_guild_member_update
handler with a middleware chain and
trailing block. Handles a Gateway::GuildMemberUpdatePayload
payload.
Creates a Client#on_guild_member_update
handler with a middleware chain.
Handles a Gateway::GuildMemberUpdatePayload
payload.
Creates a Client#on_guild_members_chunk
handler with a middleware chain and
trailing block. Handles a Gateway::GuildMembersChunkPayload
payload.
Creates a Client#on_guild_members_chunk
handler with a middleware chain.
Handles a Gateway::GuildMembersChunkPayload
payload.
Creates a Client#on_guild_role_create
handler with a middleware chain.
Handles a Gateway::GuildRolePayload
payload.
Creates a Client#on_guild_role_create
handler with a middleware chain and
trailing block. Handles a Gateway::GuildRolePayload
payload.
Creates a Client#on_guild_role_delete
handler with a middleware chain.
Handles a Gateway::GuildRoleDeletePayload
payload.
Creates a Client#on_guild_role_delete
handler with a middleware chain and
trailing block. Handles a Gateway::GuildRoleDeletePayload
payload.
Creates a Client#on_guild_role_update
handler with a middleware chain.
Handles a Gateway::GuildRolePayload
payload.
Creates a Client#on_guild_role_update
handler with a middleware chain and
trailing block. Handles a Gateway::GuildRolePayload
payload.
Creates a Client#on_guild_update
handler with a middleware chain.
Handles a Guild
payload.
Creates a Client#on_guild_update
handler with a middleware chain and
trailing block. Handles a Guild
payload.
Creates a Client#on_message_create
handler with a middleware chain and
trailing block. Handles a Message
payload.
Creates a Client#on_message_create
handler with a middleware chain.
Handles a Message
payload.
Creates a Client#on_message_delete
handler with a middleware chain and
trailing block. Handles a Gateway::MessageDeletePayload
payload.
Creates a Client#on_message_delete
handler with a middleware chain.
Handles a Gateway::MessageDeletePayload
payload.
Creates a Client#on_message_delete_bulk
handler with a middleware chain and
trailing block. Handles a Gateway::MessageDeleteBulkPayload
payload.
Creates a Client#on_message_delete_bulk
handler with a middleware chain.
Handles a Gateway::MessageDeleteBulkPayload
payload.
Creates a Client#on_message_reaction_add
handler with a middleware chain and
trailing block. Handles a Gateway::MessageReactionPayload
payload.
Creates a Client#on_message_reaction_add
handler with a middleware chain.
Handles a Gateway::MessageReactionPayload
payload.
Creates a Client#on_message_reaction_remove
handler with a middleware chain and
trailing block. Handles a Gateway::MessageReactionPayload
payload.
Creates a Client#on_message_reaction_remove
handler with a middleware chain.
Handles a Gateway::MessageReactionPayload
payload.
Creates a Client#on_message_reaction_remove_all
handler with a middleware chain.
Handles a Gateway::MessageReactionRemoveAllPayload
payload.
Creates a Client#on_message_reaction_remove_all
handler with a middleware chain and
trailing block. Handles a Gateway::MessageReactionRemoveAllPayload
payload.
Creates a Client#on_message_update
handler with a middleware chain and
trailing block. Handles a Gateway::MessageUpdatePayload
payload.
Creates a Client#on_message_update
handler with a middleware chain.
Handles a Gateway::MessageUpdatePayload
payload.
Creates a Client#on_presence_update
handler with a middleware chain.
Handles a Gateway::PresenceUpdatePayload
payload.
Creates a Client#on_presence_update
handler with a middleware chain and
trailing block. Handles a Gateway::PresenceUpdatePayload
payload.
Creates a Client#on_ready
handler with a middleware chain.
Handles a Gateway::ReadyPayload
payload.
Creates a Client#on_ready
handler with a middleware chain and
trailing block. Handles a Gateway::ReadyPayload
payload.
Creates a Client#on_resumed
handler with a middleware chain and
trailing block. Handles a Gateway::ResumedPayload
payload.
Creates a Client#on_resumed
handler with a middleware chain.
Handles a Gateway::ResumedPayload
payload.
Creates a Client#on_typing_start
handler with a middleware chain and
trailing block. Handles a Gateway::TypingStartPayload
payload.
Creates a Client#on_typing_start
handler with a middleware chain.
Handles a Gateway::TypingStartPayload
payload.
Creates a Client#on_user_update
handler with a middleware chain and
trailing block. Handles a User
payload.
Creates a Client#on_user_update
handler with a middleware chain.
Handles a User
payload.
Creates a Client#on_voice_server_update
handler with a middleware chain and
trailing block. Handles a Gateway::VoiceServerUpdatePayload
payload.
Creates a Client#on_voice_server_update
handler with a middleware chain.
Handles a Gateway::VoiceServerUpdatePayload
payload.
Creates a Client#on_voice_state_update
handler with a middleware chain and
trailing block. Handles a VoiceState
payload.
Creates a Client#on_voice_state_update
handler with a middleware chain.
Handles a VoiceState
payload.