aboutsummaryrefslogtreecommitdiff
path: root/lib/cache.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cache.ml')
-rw-r--r--lib/cache.ml33
1 files changed, 32 insertions, 1 deletions
diff --git a/lib/cache.ml b/lib/cache.ml
index db1f4e2..96ca42a 100644
--- a/lib/cache.ml
+++ b/lib/cache.ml
@@ -35,4 +35,35 @@ let create () =
let cache =
let m = Mvar.create () in
Mvar.set m (create ());
- m \ No newline at end of file
+ m
+
+let guild cache = GuildMap.find cache.guilds
+
+let text_channel cache = ChannelMap.find cache.text_channels
+
+let voice_channel cache = ChannelMap.find cache.voice_channels
+
+let category cache = ChannelMap.find cache.categories
+
+let dm cache = ChannelMap.find cache.private_channels
+
+let group cache = ChannelMap.find cache.groups
+
+let channel cache id =
+ let check = ChannelMap.find in
+ match check cache.text_channels id with
+ | Some c -> Some (`GuildText c)
+ | None -> (
+ match check cache.voice_channels id with
+ | Some c -> Some (`GuildVoice c)
+ | None -> (
+ match check cache.categories id with
+ | Some c -> Some (`Category c)
+ | None -> (
+ match check cache.private_channels id with
+ | Some c -> Some (`Private c)
+ | None -> (
+ match check cache.groups id with
+ | Some c -> Some (`Group c)
+ | None -> None
+ )))) \ No newline at end of file