feat: gateway service

This commit is contained in:
alyssa 2024-09-14 12:19:47 +09:00
parent 1118d8bdf8
commit e4ed354536
50 changed files with 1737 additions and 545 deletions

View file

@ -100,15 +100,18 @@ public static class DiscordCacheExtensions
await cache.SaveChannel(thread);
}
public static async Task<PermissionSet> BotPermissionsIn(this IDiscordCache cache, ulong channelId)
public static async Task<PermissionSet> BotPermissionsIn(this IDiscordCache cache, ulong guildId, ulong channelId)
{
var channel = await cache.GetRootChannel(channelId);
if (cache is HttpDiscordCache)
return await ((HttpDiscordCache)cache).BotPermissions(guildId, channelId);
var channel = await cache.GetRootChannel(guildId, channelId);
if (channel.GuildId != null)
{
var userId = cache.GetOwnUser();
var member = await cache.TryGetSelfMember(channel.GuildId.Value);
return await cache.PermissionsFor2(channelId, userId, member);
return await cache.PermissionsFor2(guildId, channelId, userId, member);
}
return PermissionSet.Dm;