1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-05-06 22:16:29 +03:00

Guild blacklist implementation

This commit is contained in:
Octol1ttle 2022-10-18 22:55:16 +05:00
parent e767205c1a
commit c0ae850fb8
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
9 changed files with 843 additions and 789 deletions

View file

@ -60,7 +60,7 @@ public static class Boyfriend {
await Client.StartAsync();
await Client.SetActivityAsync(Activity);
new EventHandler().InitEvents();
EventHandler.InitEvents();
await Task.Delay(-1);
}
@ -128,9 +128,12 @@ public static class Boyfriend {
public static SocketGuild FindGuild(ulong channel) {
if (GuildCache.ContainsKey(channel)) return GuildCache[channel];
foreach (var guild in Client.Guilds) {
if (guild.Channels.All(x => x.Id != channel)) continue;
GuildCache.Add(channel, guild);
return guild;
// ReSharper disable once LoopCanBeConvertedToQuery
foreach (var x in guild.Channels)
if (x.Id == channel) {
GuildCache.Add(channel, guild);
return guild;
}
}
throw new Exception("Could not find guild by channel!");