From 74e32dee9b245d1afe6d32b642b149fbfabf3e2c Mon Sep 17 00:00:00 2001 From: Octol1ttle <l1ttleofficial@outlook.com> Date: Wed, 20 Dec 2023 21:23:37 +0500 Subject: [PATCH 1/2] Use collection expressions in more places (#238) ReSharper inspections have been updated, causing new warnings to appear in the codebase. This time, the "Use collection expressions" inspection has been enabled for usecases where the collection is not empty. This PR fixes the check failures caused by this inspection. --- src/Commands/AboutCommandGroup.cs | 4 ++-- src/Commands/SettingsCommandGroup.cs | 4 ++-- src/Commands/ToolsCommandGroup.cs | 4 ++-- src/Services/Update/MemberUpdateService.cs | 4 ++-- src/Services/Update/SongUpdateService.cs | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Commands/AboutCommandGroup.cs b/src/Commands/AboutCommandGroup.cs index eec1f99..1c2656b 100644 --- a/src/Commands/AboutCommandGroup.cs +++ b/src/Commands/AboutCommandGroup.cs @@ -28,11 +28,11 @@ namespace Octobot.Commands; public class AboutCommandGroup : CommandGroup { private static readonly (string Username, Snowflake Id)[] Developers = - { + [ ("Octol1ttle", new Snowflake(504343489664909322)), ("mctaylors", new Snowflake(326642240229474304)), ("neroduckale", new Snowflake(474943797063843851)) - }; + ]; private readonly ICommandContext _context; private readonly IFeedbackService _feedback; diff --git a/src/Commands/SettingsCommandGroup.cs b/src/Commands/SettingsCommandGroup.cs index a8891bd..15fd514 100644 --- a/src/Commands/SettingsCommandGroup.cs +++ b/src/Commands/SettingsCommandGroup.cs @@ -36,7 +36,7 @@ public class SettingsCommandGroup : CommandGroup /// that the orders match. /// </remarks> private static readonly IOption[] AllOptions = - { + [ GuildSettings.Language, GuildSettings.WelcomeMessage, GuildSettings.ReceiveStartupMessages, @@ -51,7 +51,7 @@ public class SettingsCommandGroup : CommandGroup GuildSettings.MuteRole, GuildSettings.EventNotificationRole, GuildSettings.EventEarlyNotificationOffset - }; + ]; private readonly ICommandContext _context; private readonly IFeedbackService _feedback; diff --git a/src/Commands/ToolsCommandGroup.cs b/src/Commands/ToolsCommandGroup.cs index 78058cb..f04ddf6 100644 --- a/src/Commands/ToolsCommandGroup.cs +++ b/src/Commands/ToolsCommandGroup.cs @@ -393,7 +393,7 @@ public class ToolsCommandGroup : CommandGroup } private static readonly TimestampStyle[] AllStyles = - { + [ TimestampStyle.ShortDate, TimestampStyle.LongDate, TimestampStyle.ShortTime, @@ -401,7 +401,7 @@ public class ToolsCommandGroup : CommandGroup TimestampStyle.ShortDateTime, TimestampStyle.LongDateTime, TimestampStyle.RelativeTime - }; + ]; /// <summary> /// A slash command that shows the current timestamp with an optional offset in all styles supported by Discord. diff --git a/src/Services/Update/MemberUpdateService.cs b/src/Services/Update/MemberUpdateService.cs index e7860ae..8937833 100644 --- a/src/Services/Update/MemberUpdateService.cs +++ b/src/Services/Update/MemberUpdateService.cs @@ -16,7 +16,7 @@ namespace Octobot.Services.Update; public sealed partial class MemberUpdateService : BackgroundService { private static readonly string[] GenericNicknames = - { + [ "Albatross", "Alpha", "Anchor", "Banjo", "Bell", "Beta", "Blackbird", "Bulldog", "Canary", "Cat", "Calf", "Cyclone", "Daisy", "Dalmatian", "Dart", "Delta", "Diamond", "Donkey", "Duck", "Emu", "Eclipse", "Flamingo", "Flute", "Frog", "Goose", "Hatchet", "Heron", "Husky", "Hurricane", @@ -24,7 +24,7 @@ public sealed partial class MemberUpdateService : BackgroundService "Nautilus", "Ostrich", "Octopus", "Pelican", "Puffin", "Pyramid", "Rattle", "Robin", "Rose", "Salmon", "Seal", "Shark", "Sheep", "Snake", "Sonar", "Stump", "Sparrow", "Toaster", "Toucan", "Torus", "Violet", "Vortex", "Vulture", "Wagon", "Whale", "Woodpecker", "Zebra", "Zigzag" - }; + ]; private readonly IDiscordRestChannelAPI _channelApi; private readonly IDiscordRestGuildAPI _guildApi; diff --git a/src/Services/Update/SongUpdateService.cs b/src/Services/Update/SongUpdateService.cs index 391c416..53cc59b 100644 --- a/src/Services/Update/SongUpdateService.cs +++ b/src/Services/Update/SongUpdateService.cs @@ -9,7 +9,7 @@ namespace Octobot.Services.Update; public sealed class SongUpdateService : BackgroundService { private static readonly (string Author, string Name, TimeSpan Duration)[] SongList = - { + [ ("Yoko & the Gold Bazookas", "Rockagilly Blues", new TimeSpan(0, 2, 52)), ("Deep Cut", "Big Betrayal", new TimeSpan(0, 5, 55)), ("Squid Sisters", "Tomorrow's Nostalgia Today", new TimeSpan(0, 3, 7)), @@ -30,7 +30,7 @@ public sealed class SongUpdateService : BackgroundService ("Turquoise October", "Octoling Rendezvous", new TimeSpan(0, 1, 57)), ("Damp Socks feat. Off the Hook", "Tentacle to the Metal", new TimeSpan(0, 2, 51)), ("Off the Hook", "Fly Octo Fly ~ Ebb & Flow (Octo)", new TimeSpan(0, 3, 5)) - }; + ]; private readonly List<Activity> _activityList = [new Activity("with Remora.Discord", ActivityType.Game)]; From 6688481093ab217a0e8b036dc00122b82acc71e0 Mon Sep 17 00:00:00 2001 From: Macintxsh <95250141+mctaylors@users.noreply.github.com> Date: Wed, 20 Dec 2023 19:25:13 +0300 Subject: [PATCH 2/2] /about: Show Discord bot username instead of hardcoded one (#230) In this PR, I made it so that in the Author field instead of the hardcoded name was the name of the Discord bot. This was done to match the icon next to it in the same field. Replaces #224 --------- Signed-off-by: mctaylors <cantsendmails@mctaylors.ru> --- locale/Messages.resx | 2 +- locale/Messages.ru.resx | 2 +- locale/Messages.tt-ru.resx | 2 +- src/Commands/AboutCommandGroup.cs | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/locale/Messages.resx b/locale/Messages.resx index 743dd93..60e6e07 100644 --- a/locale/Messages.resx +++ b/locale/Messages.resx @@ -400,7 +400,7 @@ <value>Octobot's source code</value> </data> <data name="AboutBot" xml:space="preserve"> - <value>About Octobot</value> + <value>About {0}</value> </data> <data name="AboutDeveloper@mctaylors" xml:space="preserve"> <value>developer & designer, Octobot's Wiki creator</value> diff --git a/locale/Messages.ru.resx b/locale/Messages.ru.resx index 67a1d29..4b9492c 100644 --- a/locale/Messages.ru.resx +++ b/locale/Messages.ru.resx @@ -400,7 +400,7 @@ <value>Исходный код Octobot</value> </data> <data name="AboutBot" xml:space="preserve"> - <value>Об Octobot</value> + <value>О боте {0}</value> </data> <data name="AboutDeveloper@neroduckale" xml:space="preserve"> <value>разработчик</value> diff --git a/locale/Messages.tt-ru.resx b/locale/Messages.tt-ru.resx index 4050d43..de1f39f 100644 --- a/locale/Messages.tt-ru.resx +++ b/locale/Messages.tt-ru.resx @@ -400,7 +400,7 @@ <value>репа Octobot (тык)</value> </data> <data name="AboutBot" xml:space="preserve"> - <value>немного об Octobot</value> + <value>немного об {0}</value> </data> <data name="AboutDeveloper@mctaylors" xml:space="preserve"> <value>скучный девелопер + дизайнер создавший Octobot's Wiki</value> diff --git a/src/Commands/AboutCommandGroup.cs b/src/Commands/AboutCommandGroup.cs index 1c2656b..4c396d9 100644 --- a/src/Commands/AboutCommandGroup.cs +++ b/src/Commands/AboutCommandGroup.cs @@ -96,7 +96,8 @@ public class AboutCommandGroup : CommandGroup builder.AppendBulletPointLine($"{tag} — {$"AboutDeveloper@{dev.Username}".Localized()}"); } - var embed = new EmbedBuilder().WithSmallTitle(Messages.AboutBot, bot) + var embed = new EmbedBuilder() + .WithSmallTitle(string.Format(Messages.AboutBot, bot.Username), bot) .WithDescription(builder.ToString()) .WithColour(ColorsList.Cyan) .WithImageUrl("https://cdn.mctaylors.ru/octobot-banner.png")