.qimport will is no longer owner only on the public bot

Creds issues should now be properly caught and logged, instead of showing unhandled exceptions
This commit is contained in:
Toastie (DCS Team) 2024-09-11 20:41:00 +12:00
parent 140a35b82a
commit 78366ab7e4
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
4 changed files with 12 additions and 13 deletions

1
.gitignore vendored
View file

@ -21,6 +21,7 @@ src/EllieBot/old_credentials.json
src/EllieBot/credentials.json.bak src/EllieBot/credentials.json.bak
src/EllieBot/data/EllieBot.db src/EllieBot/data/EllieBot.db
ellie-menu.ps1 ellie-menu.ps1
package.sh
# Created by https://www.gitignore.io/api/visualstudio,visualstudiocode,windows,linux,macos # Created by https://www.gitignore.io/api/visualstudio,visualstudiocode,windows,linux,macos

View file

@ -401,6 +401,7 @@ public partial class EllieExpressions : EllieModule<EllieExpressionsService>
} }
[Cmd] [Cmd]
[Ratelimit(300)]
public async Task ExprsImport([Leftover] string input = null) public async Task ExprsImport([Leftover] string input = null)
{ {
// todo cooldown on public bot for 1 day, limit 100 // todo cooldown on public bot for 1 day, limit 100

View file

@ -351,9 +351,6 @@ public partial class Utility
[RequireContext(ContextType.Guild)] [RequireContext(ContextType.Guild)]
[UserPerm(GuildPerm.Administrator)] [UserPerm(GuildPerm.Administrator)]
[Ratelimit(300)] [Ratelimit(300)]
#if GLOBAL_NADEKO
[OwnerOnly]
#endif
public async Task QuotesImport([Leftover] string? input = null) public async Task QuotesImport([Leftover] string? input = null)
{ {
input = input?.Trim(); input = input?.Trim();

View file

@ -49,18 +49,18 @@ public sealed class BotCredsProvider : IBotCredsProvider
// this can fail in docker containers // this can fail in docker containers
} }
MigrateCredentials();
if (!File.Exists(CredsPath))
{
Log.Warning(
"{CredsPath} is missing. Attempting to load creds from environment variables prefixed with 'EllieBot_'. Example is in {CredsExamplePath}",
CredsPath,
CredsExamplePath);
}
try try
{ {
MigrateCredentials();
if (!File.Exists(CredsPath))
{
Log.Warning(
"{CredsPath} is missing. Attempting to load creds from environment variables prefixed with 'EllieBot_'. Example is in {CredsExamplePath}",
CredsPath,
CredsExamplePath);
}
_config = new ConfigurationBuilder().AddYamlFile(CredsPath, false, true) _config = new ConfigurationBuilder().AddYamlFile(CredsPath, false, true)
.AddEnvironmentVariables("EllieBot_") .AddEnvironmentVariables("EllieBot_")
.Build(); .Build();