diff options
| author | Adelyn Breedlove <[email protected]> | 2019-01-28 10:31:51 -0700 |
|---|---|---|
| committer | Adelyn Breedlove <[email protected]> | 2019-01-28 10:31:51 -0700 |
| commit | 8662e92987c437f59d09896a247ec2b5d82c4528 (patch) | |
| tree | f004cc14598351d4ad6b19d8e993d2f629c5e738 /lib/models/guild/guild.ml | |
| parent | Add more docs (diff) | |
| download | disml-8662e92987c437f59d09896a247ec2b5d82c4528.tar.xz disml-8662e92987c437f59d09896a247ec2b5d82c4528.zip | |
Publish docs updates
Diffstat (limited to 'lib/models/guild/guild.ml')
| -rw-r--r-- | lib/models/guild/guild.ml | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/lib/models/guild/guild.ml b/lib/models/guild/guild.ml index 812a49e..b1e8bfe 100644 --- a/lib/models/guild/guild.ml +++ b/lib/models/guild/guild.ml @@ -1,22 +1,22 @@ -open Core -open Async - -include Guild_t -include Impl.Guild(Guild_t) - -let get_member ~(id:User_id_t.t) guild = - match List.find ~f:(fun m -> m.user.id = id) guild.members with - | Some m -> Deferred.Or_error.return m - | None -> - let `User_id id = id in - Http.get_member (get_id guild) id - -let get_channel ~(id:Channel_id_t.t) guild = - let `Channel_id id = id in - match List.find ~f:(fun c -> Channel_t.get_id c = id) guild.channels with - | Some c -> Deferred.Or_error.return c - | None -> Http.get_channel id - -(* TODO add HTTP fallback *) -let get_role ~(id:Role_id.t) guild = +open Core
+open Async
+
+include Guild_t
+include Impl.Guild(Guild_t)
+
+let get_member ~(id:User_id_t.t) guild =
+ match List.find ~f:(fun m -> m.user.id = id) guild.members with
+ | Some m -> Deferred.Or_error.return m
+ | None ->
+ let `User_id id = id in
+ Http.get_member (get_id guild) id
+
+let get_channel ~(id:Channel_id_t.t) guild =
+ let `Channel_id id = id in
+ match List.find ~f:(fun c -> Channel_t.get_id c = id) guild.channels with
+ | Some c -> Deferred.Or_error.return c
+ | None -> Http.get_channel id
+
+(* TODO add HTTP fallback *)
+let get_role ~(id:Role_id.t) guild =
List.find ~f:(fun r -> r.id = id) guild.roles
\ No newline at end of file |