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:
parent
e767205c1a
commit
c0ae850fb8
9 changed files with 843 additions and 789 deletions
|
@ -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!");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue