From 6f2ad42b90ec826cd2852a76a5108686d01a52a0 Mon Sep 17 00:00:00 2001 From: Emotion Date: Wed, 23 Aug 2023 23:18:46 +1200 Subject: [PATCH] Fixed a few fun bugs Signed-off-by: Emotion --- src/Ellie.Bot.Common/Creds.cs | 25 +++++++++---------- .../Self/CheckForUpdatesService.cs | 2 +- src/Ellie.Bot.Modules.Music/Music.cs | 20 +++++++-------- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/Ellie.Bot.Common/Creds.cs b/src/Ellie.Bot.Common/Creds.cs index a8354c9..750277c 100644 --- a/src/Ellie.Bot.Common/Creds.cs +++ b/src/Ellie.Bot.Common/Creds.cs @@ -1,6 +1,5 @@ #nullable disable using Ellie.Common.Yml; -using Microsoft.EntityFrameworkCore; namespace Ellie.Common; @@ -17,7 +16,7 @@ public sealed class Creds : IBotCredentials **DO NOT ADD PEOPLE YOU DON'T TRUST** """)] public ICollection OwnerIds { get; set; } - + [Comment("Keep this on 'true' unless you're sure your bot shouldn't use privileged intents or you're waiting to be accepted")] public bool UsePrivilegedIntents { get; set; } @@ -30,15 +29,15 @@ public sealed class Creds : IBotCredentials """)] public int TotalShards { get; set; } - [Comment( + [Comment( """ Login to https://console.cloud.google.com, create a new project, go to APIs & Services -> Library -> YouTube Data API and enable it. Then, go to APIs and Services -> Credentials and click Create credentials -> API key. Used only for Youtube Data Api (at the moment). """)] public string GoogleApiKey { get; set; } - - [Comment( + + [Comment( """ Create a new custom search here https://programmablesearchengine.google.com/cse/create/new Enable SafeSearch @@ -67,14 +66,14 @@ public sealed class Creds : IBotCredentials [Comment(@"Official GPT-3 api key.")] public string Gpt3ApiKey { get; set; } - + [Comment(""" Which cache implementation should bot use. 'memory' - Cache will be in memory of the bot's process itself. Only use this on bots with a single shard. When the bot is restarted the cache is reset. 'redis' - Uses redis (which needs to be separately downloaded and installed). The cache will persist through bot restarts. You can configure connection string in creds.yml """)] public BotCacheImplemenation BotCache { get; set; } - + [Comment(""" Redis connection string. Don't change if you don't know what you're doing. Only used if botCache is set to 'redis' @@ -111,10 +110,10 @@ public sealed class Creds : IBotCredentials Used for cryptocurrency related commands. """)] public string CoinmarketcapApiKey { get; set; } - - // [Comment(@"https://polygon.io/dashboard/api-keys api key. Free plan allows for 5 queries per minute. - // Used for stocks related commands.")] - // public string PolygonIoApiKey { get; set; } + +// [Comment(@"https://polygon.io/dashboard/api-keys api key. Free plan allows for 5 queries per minute. +// Used for stocks related commands.")] +// public string PolygonIoApiKey { get; set; } [Comment("""Api key used for Osu related commands. Obtain this key at https://osu.ppy.sh/p/api""")] public string OsuApiKey { get; set; } @@ -172,7 +171,7 @@ public sealed class Creds : IBotCredentials RestartCommand = new RestartConfig(); Google = new GoogleApiConfig(); } - + public class DbOptions : IDbOptions { @@ -270,4 +269,4 @@ public class GoogleApiConfig : IGoogleApiConfig { public string SearchId { get; init; } public string ImageSearchId { get; init; } -} +} \ No newline at end of file diff --git a/src/Ellie.Bot.Modules.Administration/Self/CheckForUpdatesService.cs b/src/Ellie.Bot.Modules.Administration/Self/CheckForUpdatesService.cs index 2b5c9e3..f121f8c 100644 --- a/src/Ellie.Bot.Modules.Administration/Self/CheckForUpdatesService.cs +++ b/src/Ellie.Bot.Modules.Administration/Self/CheckForUpdatesService.cs @@ -2,7 +2,7 @@ using System.Net.Http.Json; using System.Text; using Ellie.Common.ModuleBehaviors; -namespace NadekoBot.Modules.Administration.Self; +namespace Ellie.Modules.Administration.Self; public sealed class CheckForUpdatesService : IEService, IReadyExecutor { diff --git a/src/Ellie.Bot.Modules.Music/Music.cs b/src/Ellie.Bot.Modules.Music/Music.cs index e18caea..8224bbf 100644 --- a/src/Ellie.Bot.Modules.Music/Music.cs +++ b/src/Ellie.Bot.Modules.Music/Music.cs @@ -13,9 +13,9 @@ public sealed partial class Music : EllieModule { N = 0, No = 0, None = 0, T = 1, Track = 1, S = 1, Song = 1, - Q = 2, Queue = 1, Playlist = 2, Pl = 2 + Q = 2, Queue = 2, Playlist = 2, Pl = 2 } - + public const string MUSIC_ICON_URL = "https://i.imgur.com/nhKS3PT.png"; private const int LQ_ITEMS_PER_PAGE = 9; @@ -86,7 +86,7 @@ public sealed partial class Music : EllieModule return true; } - + private async Task QueueByQuery(string query, bool asNext = false, MusicPlatform? forcePlatform = null) { var succ = await QueuePreconditionInternalAsync(); @@ -110,10 +110,10 @@ public sealed partial class Music : EllieModule try { var embed = _eb.Create() - .WithOkColor() - .WithAuthor(GetText(strs.queued_track) + " #" + (index + 1), MUSIC_ICON_URL) - .WithDescription($"{trackInfo.PrettyName()}\n{GetText(strs.queue)} ") - .WithFooter(trackInfo.Platform.ToString()); + .WithOkColor() + .WithAuthor(GetText(strs.queued_track) + " #" + (index + 1), MUSIC_ICON_URL) + .WithDescription($"{trackInfo.PrettyName()}\n{GetText(strs.queue)} ") + .WithFooter(trackInfo.Platform.ToString()); if (!string.IsNullOrWhiteSpace(trackInfo.Thumbnail)) embed.WithThumbnailUrl(trackInfo.Thumbnail); @@ -131,7 +131,7 @@ public sealed partial class Music : EllieModule // ignored } } - + private async Task MoveToIndex(int index) { if (--index < 0) @@ -150,7 +150,7 @@ public sealed partial class Music : EllieModule mp.MoveTo(index); } - + // join vc [Cmd] [RequireContext(ContextType.Guild)] @@ -168,7 +168,7 @@ public sealed partial class Music : EllieModule await _service.JoinVoiceChannelAsync(user.GuildId, voiceChannelId.Value); } - + // leave vc (destroy) [Cmd] [RequireContext(ContextType.Guild)]