Fixed a few fun bugs

Signed-off-by: Emotion <emotion@emotionchild.com>
This commit is contained in:
Emotion 2023-08-23 23:18:46 +12:00
parent 145eee4337
commit 6f2ad42b90
No known key found for this signature in database
GPG key ID: D7D3E4C27A98C37B
3 changed files with 23 additions and 24 deletions

View file

@ -1,6 +1,5 @@
#nullable disable #nullable disable
using Ellie.Common.Yml; using Ellie.Common.Yml;
using Microsoft.EntityFrameworkCore;
namespace Ellie.Common; namespace Ellie.Common;
@ -17,7 +16,7 @@ public sealed class Creds : IBotCredentials
**DO NOT ADD PEOPLE YOU DON'T TRUST** **DO NOT ADD PEOPLE YOU DON'T TRUST**
""")] """)]
public ICollection<ulong> OwnerIds { get; set; } public ICollection<ulong> 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")] [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; } public bool UsePrivilegedIntents { get; set; }
@ -30,15 +29,15 @@ public sealed class Creds : IBotCredentials
""")] """)]
public int TotalShards { get; set; } 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. 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. Then, go to APIs and Services -> Credentials and click Create credentials -> API key.
Used only for Youtube Data Api (at the moment). Used only for Youtube Data Api (at the moment).
""")] """)]
public string GoogleApiKey { get; set; } public string GoogleApiKey { get; set; }
[Comment( [Comment(
""" """
Create a new custom search here https://programmablesearchengine.google.com/cse/create/new Create a new custom search here https://programmablesearchengine.google.com/cse/create/new
Enable SafeSearch Enable SafeSearch
@ -67,14 +66,14 @@ public sealed class Creds : IBotCredentials
[Comment(@"Official GPT-3 api key.")] [Comment(@"Official GPT-3 api key.")]
public string Gpt3ApiKey { get; set; } public string Gpt3ApiKey { get; set; }
[Comment(""" [Comment("""
Which cache implementation should bot use. 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. '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 '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; } public BotCacheImplemenation BotCache { get; set; }
[Comment(""" [Comment("""
Redis connection string. Don't change if you don't know what you're doing. Redis connection string. Don't change if you don't know what you're doing.
Only used if botCache is set to 'redis' Only used if botCache is set to 'redis'
@ -111,10 +110,10 @@ public sealed class Creds : IBotCredentials
Used for cryptocurrency related commands. Used for cryptocurrency related commands.
""")] """)]
public string CoinmarketcapApiKey { get; set; } public string CoinmarketcapApiKey { get; set; }
// [Comment(@"https://polygon.io/dashboard/api-keys api key. Free plan allows for 5 queries per minute. // [Comment(@"https://polygon.io/dashboard/api-keys api key. Free plan allows for 5 queries per minute.
// Used for stocks related commands.")] // Used for stocks related commands.")]
// public string PolygonIoApiKey { get; set; } // public string PolygonIoApiKey { get; set; }
[Comment("""Api key used for Osu related commands. Obtain this key at https://osu.ppy.sh/p/api""")] [Comment("""Api key used for Osu related commands. Obtain this key at https://osu.ppy.sh/p/api""")]
public string OsuApiKey { get; set; } public string OsuApiKey { get; set; }
@ -172,7 +171,7 @@ public sealed class Creds : IBotCredentials
RestartCommand = new RestartConfig(); RestartCommand = new RestartConfig();
Google = new GoogleApiConfig(); Google = new GoogleApiConfig();
} }
public class DbOptions public class DbOptions
: IDbOptions : IDbOptions
{ {
@ -270,4 +269,4 @@ public class GoogleApiConfig : IGoogleApiConfig
{ {
public string SearchId { get; init; } public string SearchId { get; init; }
public string ImageSearchId { get; init; } public string ImageSearchId { get; init; }
} }

View file

@ -2,7 +2,7 @@ using System.Net.Http.Json;
using System.Text; using System.Text;
using Ellie.Common.ModuleBehaviors; using Ellie.Common.ModuleBehaviors;
namespace NadekoBot.Modules.Administration.Self; namespace Ellie.Modules.Administration.Self;
public sealed class CheckForUpdatesService : IEService, IReadyExecutor public sealed class CheckForUpdatesService : IEService, IReadyExecutor
{ {

View file

@ -13,9 +13,9 @@ public sealed partial class Music : EllieModule<IMusicService>
{ {
N = 0, No = 0, None = 0, N = 0, No = 0, None = 0,
T = 1, Track = 1, S = 1, Song = 1, 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"; public const string MUSIC_ICON_URL = "https://i.imgur.com/nhKS3PT.png";
private const int LQ_ITEMS_PER_PAGE = 9; private const int LQ_ITEMS_PER_PAGE = 9;
@ -86,7 +86,7 @@ public sealed partial class Music : EllieModule<IMusicService>
return true; return true;
} }
private async Task QueueByQuery(string query, bool asNext = false, MusicPlatform? forcePlatform = null) private async Task QueueByQuery(string query, bool asNext = false, MusicPlatform? forcePlatform = null)
{ {
var succ = await QueuePreconditionInternalAsync(); var succ = await QueuePreconditionInternalAsync();
@ -110,10 +110,10 @@ public sealed partial class Music : EllieModule<IMusicService>
try try
{ {
var embed = _eb.Create() var embed = _eb.Create()
.WithOkColor() .WithOkColor()
.WithAuthor(GetText(strs.queued_track) + " #" + (index + 1), MUSIC_ICON_URL) .WithAuthor(GetText(strs.queued_track) + " #" + (index + 1), MUSIC_ICON_URL)
.WithDescription($"{trackInfo.PrettyName()}\n{GetText(strs.queue)} ") .WithDescription($"{trackInfo.PrettyName()}\n{GetText(strs.queue)} ")
.WithFooter(trackInfo.Platform.ToString()); .WithFooter(trackInfo.Platform.ToString());
if (!string.IsNullOrWhiteSpace(trackInfo.Thumbnail)) if (!string.IsNullOrWhiteSpace(trackInfo.Thumbnail))
embed.WithThumbnailUrl(trackInfo.Thumbnail); embed.WithThumbnailUrl(trackInfo.Thumbnail);
@ -131,7 +131,7 @@ public sealed partial class Music : EllieModule<IMusicService>
// ignored // ignored
} }
} }
private async Task MoveToIndex(int index) private async Task MoveToIndex(int index)
{ {
if (--index < 0) if (--index < 0)
@ -150,7 +150,7 @@ public sealed partial class Music : EllieModule<IMusicService>
mp.MoveTo(index); mp.MoveTo(index);
} }
// join vc // join vc
[Cmd] [Cmd]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
@ -168,7 +168,7 @@ public sealed partial class Music : EllieModule<IMusicService>
await _service.JoinVoiceChannelAsync(user.GuildId, voiceChannelId.Value); await _service.JoinVoiceChannelAsync(user.GuildId, voiceChannelId.Value);
} }
// leave vc (destroy) // leave vc (destroy)
[Cmd] [Cmd]
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]