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