From e97037d486983c0fd5c5d892f8ade509e9bfee33 Mon Sep 17 00:00:00 2001 From: Adelyn Breelove Date: Thu, 31 Jan 2019 13:30:49 -0700 Subject: Add entry point doc stuff --- lib/disml.ml | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) (limited to 'lib') diff --git a/lib/disml.ml b/lib/disml.ml index c7c4c34..922a4d3 100644 --- a/lib/disml.ml +++ b/lib/disml.ml @@ -1,24 +1,100 @@ +(** + {2 Dis.ml - An OCaml wrapper for the Discord API} + + {3 Example} + + {[ + open Async + open Core + open Disml + open Models + + (* Create a function to handle message_create. *) + let check_command (Event.MessageCreate.{message}) = + if String.is_prefix ~prefix:"!ping" message.content then + Message.reply message "Pong!" >>> ignore + + let main () = + (* Register the event handler *) + Client.message_create := check_command; + (* Start the client. It's recommended to load the token from an env var or other config file. *) + Client.start "My token" >>> ignore + + let _ = + (* Launch the Async scheduler. You must do this for anything to work. *) + Scheduler.go_main ~main () + ]} +*) + +(** The primary interface for connecting to Discord and handling gateway events. *) module Client = Client + +(** Raw HTTP abstractions for Discord's REST API. *) module Http = Http + +(** Gateway connection and sharding manager. *) module Sharder = Sharder +(** Super module for all Discord object types. *) module Models = struct + + (** Represents a user's activity. *) module Activity = Activity + + (** Represents a message attachment. *) module Attachment = Attachment + + (** Represents a ban object. *) module Ban = Ban + + (** Represents a full channel object. *) module Channel = Channel + + (** Represents solely a channel ID. REST operations can be performed without the full object overhead using this. *) module Channel_id = Channel_id + + (** Represents an embed object. *) module Embed = Embed + + (** Represents an emoji, both custom and unicode. *) module Emoji = Emoji + + (** Represents a guild object, also called a server. *) module Guild = Guild + + (** Represents solely a guild ID. REST operations can be performed without the full object overhead using this. *) module Guild_id = Guild_id + + (** Represents a user in the context of a guild. *) module Member = Member + + (** Represents a message object in any channel. *) module Message = Message + + (** Represents solely a message ID. REST operations can be performed without the full object overhead using this. *) + module Message_id = Message_id + + (** Represents a user presence. See {!Models.Event.PresenceUpdate}. *) module Presence = Presence + + (** Represents an emoji used to react to a message. *) module Reaction = Reaction + + (** Represents a role object. *) module Role = Role + + (** Represents solely a role ID. REST operations can be performed without the full object overhead using this. *) + module Role_id = Role_id + + (** Represents a Discord ID. *) module Snowflake = Snowflake + + (** Represents a user object. *) module User = User + + (** Represents solely a user ID. REST operations can be performed without the full object overhead using this. *) + module User_id = User_id + (** Represents the structures received over the gateway. *) module Event = Event_models end \ No newline at end of file -- cgit v1.2.3