diff options
| author | Adelyn Breedlove <[email protected]> | 2019-01-27 14:09:33 -0700 |
|---|---|---|
| committer | Adelyn Breedlove <[email protected]> | 2019-01-27 14:09:33 -0700 |
| commit | fbd3597c7ab798cf10a447eb2b477dd4e3ed6d33 (patch) | |
| tree | 16d1ef889e9c6f1090dd911e6fb31392625066c2 /lib/models/guild/guild.ml | |
| parent | hopeful reconnection fix (diff) | |
| download | disml-fbd3597c7ab798cf10a447eb2b477dd4e3ed6d33.tar.xz disml-fbd3597c7ab798cf10a447eb2b477dd4e3ed6d33.zip | |
Switch to ID abstractions internally
Diffstat (limited to 'lib/models/guild/guild.ml')
| -rw-r--r-- | lib/models/guild/guild.ml | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/models/guild/guild.ml b/lib/models/guild/guild.ml index 926b152..812a49e 100644 --- a/lib/models/guild/guild.ml +++ b/lib/models/guild/guild.ml @@ -4,16 +4,19 @@ open Async include Guild_t include Impl.Guild(Guild_t) -let get_member ~id guild = +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 -> Http.get_member (get_id guild) id + | None -> + let `User_id id = id in + Http.get_member (get_id guild) id -let get_channel ~id guild = +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 guild = +let get_role ~(id:Role_id.t) guild = List.find ~f:(fun r -> r.id = id) guild.roles
\ No newline at end of file |