blob: 926b1521148c4fea31dbb4630ce2f83d9f438aa2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
open Core
open Async
include Guild_t
include Impl.Guild(Guild_t)
let get_member ~id 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
let get_channel ~id guild =
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 =
List.find ~f:(fun r -> r.id = id) guild.roles
|