diff options
| author | Adelyn Breelove <[email protected]> | 2019-01-21 10:03:11 -0700 |
|---|---|---|
| committer | Adelyn Breelove <[email protected]> | 2019-01-21 10:03:11 -0700 |
| commit | 83dd4a34eec5eb508438dab55d40bf9f0a78607d (patch) | |
| tree | 034bad7f6a119fff9354f1a469c109adafcc63a7 /lib | |
| parent | start using Logs (diff) | |
| download | disml-83dd4a34eec5eb508438dab55d40bf9f0a78607d.tar.xz disml-83dd4a34eec5eb508438dab55d40bf9f0a78607d.zip | |
Finalize signatures
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/client.mli | 17 | ||||
| -rw-r--r-- | lib/event.ml | 2 | ||||
| -rw-r--r-- | lib/event.mli | 44 |
3 files changed, 61 insertions, 2 deletions
diff --git a/lib/client.mli b/lib/client.mli new file mode 100644 index 0000000..6f6a18d --- /dev/null +++ b/lib/client.mli @@ -0,0 +1,17 @@ +open Async + +include module type of Client_options +include module type of Dispatch + +type t = { + sharder: Sharder.t; + token: string; +} + +val start : ?count:int -> string -> t Deferred.t + +val set_status : status:Yojson.Safe.json -> t -> Sharder.Shard.shard list Deferred.t + +val set_status_with : f:(Sharder.Shard.shard -> Yojson.Safe.json) -> t -> Sharder.Shard.shard list Deferred.t + +val request_guild_members : guild:Snowflake.t -> ?query:string -> ?limit:int -> t -> Sharder.Shard.shard list Deferred.t
\ No newline at end of file diff --git a/lib/event.ml b/lib/event.ml index 9b12792..1ac9402 100644 --- a/lib/event.ml +++ b/lib/event.ml @@ -115,8 +115,6 @@ let dispatch ev = match ev with | WEBHOOKS_UPDATE d -> !Dispatch.webhooks_update d let handle_event ~ev contents = - (* Printf.printf "Dispatching %s\n%!" ev; *) - (* print_endline (Yojson.Safe.prettify contents); *) try event_of_yojson ~contents ev |> dispatch diff --git a/lib/event.mli b/lib/event.mli new file mode 100644 index 0000000..8f0ab5f --- /dev/null +++ b/lib/event.mli @@ -0,0 +1,44 @@ +exception Invalid_event of string + +type t = +| HELLO of Yojson.Safe.json +| READY of Yojson.Safe.json +| RESUMED of Yojson.Safe.json +| INVALID_SESSION of Yojson.Safe.json +| CHANNEL_CREATE of Channel_t.t +| CHANNEL_UPDATE of Channel_t.t +| CHANNEL_DELETE of Channel_t.t +| CHANNEL_PINS_UPDATE of Yojson.Safe.json +| GUILD_CREATE of Guild_t.t +| GUILD_UPDATE of Guild_t.t +| GUILD_DELETE of Guild_t.t +| GUILD_BAN_ADD of Ban_t.t +| GUILD_BAN_REMOVE of Ban_t.t +| GUILD_EMOJIS_UPDATE of Yojson.Safe.json +| GUILD_INTEGRATIONS_UPDATE of Yojson.Safe.json +| GUILD_MEMBER_ADD of Member_t.t +| GUILD_MEMBER_REMOVE of Member_t.member_wrapper +| GUILD_MEMBER_UPDATE of Member_t.member_update +| GUILD_MEMBERS_CHUNK of Member_t.t list +| GUILD_ROLE_CREATE of Role_t.t +| GUILD_ROLE_UPDATE of Role_t.t +| GUILD_ROLE_DELETE of Role_t.t +| MESSAGE_CREATE of Message_t.t +| MESSAGE_UPDATE of Message_t.message_update +| MESSAGE_DELETE of Snowflake.t * Snowflake.t +| MESSAGE_BULK_DELETE of Snowflake.t list +| MESSAGE_REACTION_ADD of Reaction_t.reaction_event +| MESSAGE_REACTION_REMOVE of Reaction_t.reaction_event +| MESSAGE_REACTION_REMOVE_ALL of Reaction_t.t list +| PRESENCE_UPDATE of Presence.t +| TYPING_START of Yojson.Safe.json +| USER_UPDATE of Yojson.Safe.json +| VOICE_STATE_UPDATE of Yojson.Safe.json +| VOICE_SERVER_UPDATE of Yojson.Safe.json +| WEBHOOKS_UPDATE of Yojson.Safe.json + +val event_of_yojson : contents:Yojson.Safe.json -> string -> t + +val dispatch : t -> unit + +val handle_event : ev:string -> Yojson.Safe.json -> unit
\ No newline at end of file |