From 7fe6549bb306401a82aededb34a6a1097429af33 Mon Sep 17 00:00:00 2001 From: mctaylors Date: Sat, 22 Oct 2022 19:25:43 +0300 Subject: [PATCH] Added support for multiple Activities Co-authored-by: Octol1ttle --- Boyfriend/Boyfriend.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/Boyfriend/Boyfriend.cs b/Boyfriend/Boyfriend.cs index b0ec6ce..e8f7ee2 100644 --- a/Boyfriend/Boyfriend.cs +++ b/Boyfriend/Boyfriend.cs @@ -19,8 +19,13 @@ public static class Boyfriend { LargeThreshold = 500 }; + private static readonly List> ActivityList = new() { + Tuple.Create(new Game("C418 - Mall", ActivityType.Listening), new TimeSpan(0, 3, 18)), + Tuple.Create(new Game("C418 - Thirteen", ActivityType.Listening), new TimeSpan(0, 2, 57)), + Tuple.Create(new Game("Spotify Ads", ActivityType.Listening), new TimeSpan(0, 0, 15)) + }; + public static readonly DiscordSocketClient Client = new(Config); - private static readonly Game Activity = new("UNDEAD CORPORATION - Everything will freeze", ActivityType.Listening); private static readonly Dictionary> GuildConfigDictionary = new(); @@ -58,11 +63,16 @@ public static class Boyfriend { await Client.LoginAsync(TokenType.Bot, token); await Client.StartAsync(); - await Client.SetActivityAsync(Activity); EventHandler.InitEvents(); - await Task.Delay(-1); + while (true) { + foreach (var activity in ActivityList) { + await Client.SetActivityAsync(activity.Item1); + await Task.Delay(activity.Item2); + } + } + // ReSharper disable once FunctionNeverReturns } private static Task Log(LogMessage msg) { @@ -124,7 +134,6 @@ public static class Boyfriend { return removedRoles; } - public static SocketGuild FindGuild(ulong channel) { if (GuildCache.TryGetValue(channel, out var gld)) return gld; foreach (var guild in Client.Guilds) {