Preliminary support for APIv9 and threads

This commit is contained in:
Ske
2021-07-15 12:41:19 +02:00
parent 0e7bcb993e
commit 1f2b9f998d
19 changed files with 127 additions and 24 deletions

View File

@@ -75,5 +75,15 @@ namespace Myriad.Extensions
await cache.SaveChannel(restChannel);
return restChannel;
}
public static Channel GetRootChannel(this IDiscordCache cache, ulong channelOrThread)
{
var channel = cache.GetChannel(channelOrThread);
if (!channel.IsThread())
return channel;
var parent = cache.GetChannel(channel.ParentId!.Value);
return parent;
}
}
}