Fixed a few things

This commit is contained in:
Emotion 2023-07-15 22:37:02 +12:00
parent feb074a392
commit f4690ca004
No known key found for this signature in database
GPG key ID: D7D3E4C27A98C37B
13 changed files with 16 additions and 16 deletions

View file

@ -1,7 +1,7 @@
namespace Ellie.Common.Attributes; namespace Ellie.Common.Attributes;
[AttributeUsage(AttributeTargets.Method)] [AttributeUsage(AttributeTargets.Method)]
public sealed class NadekoOptionsAttribute<TOption> : Attribute public sealed class EllieOptionsAttribute<TOption> : Attribute
where TOption: IEllieCommandOptions where TOption: IEllieCommandOptions
{ {
} }

View file

@ -12,7 +12,7 @@ public sealed class OnlyPublicBotAttribute : PreconditionAttribute
CommandInfo command, CommandInfo command,
IServiceProvider services) IServiceProvider services)
{ {
#if GLOBAL_NADEKO || DEBUG #if GLOBAL_ELLIE || DEBUG
return Task.FromResult(PreconditionResult.FromSuccess()); return Task.FromResult(PreconditionResult.FromSuccess());
#else #else
return Task.FromResult(PreconditionResult.FromError("Only available on the public bot.")); return Task.FromResult(PreconditionResult.FromError("Only available on the public bot."));

View file

@ -13,7 +13,7 @@ public class DownloadTracker : IEService
/// <returns>Task representing download state</returns> /// <returns>Task representing download state</returns>
public async Task EnsureUsersDownloadedAsync(IGuild guild) public async Task EnsureUsersDownloadedAsync(IGuild guild)
{ {
#if GLOBAL_NADEKO #if GLOBAL_ELLIE
return; return;
#endif #endif
await _downloadUsersSemaphore.WaitAsync(); await _downloadUsersSemaphore.WaitAsync();

View file

@ -1,6 +1,6 @@
using Ellie.Db; using Ellie.Db;
using Ellie.Db.Models; using Ellie.Db.Models;
// todo fix these namespaces. It should only be Nadeko.Bot.Db // todo fix these namespaces. It should only be Ellie.Bot.Db
using Ellie.Services.Database; using Ellie.Services.Database;
namespace Ellie.Extensions; namespace Ellie.Extensions;

View file

@ -2,7 +2,7 @@
/// <summary> /// <summary>
/// This interface's method is executed after the command successfully finished execution. /// This interface's method is executed after the command successfully finished execution.
/// ***There is no support for this method in NadekoBot services.*** /// ***There is no support for this method in Ellie services.***
/// It is only meant to be used in medusa system /// It is only meant to be used in medusa system
/// </summary> /// </summary>
public interface IExecPostCommand : IBehavior public interface IExecPostCommand : IBehavior

View file

@ -224,7 +224,7 @@ public class CommandHandler : IEService, IReadyExecutor, ICommandHandler
{ {
try try
{ {
#if !GLOBAL_NADEKO #if !GLOBAL_ELLIE
// track how many messages each user is sending // track how many messages each user is sending
UserMessagesSent.AddOrUpdate(usrMsg.Author.Id, 1, (_, old) => ++old); UserMessagesSent.AddOrUpdate(usrMsg.Author.Id, 1, (_, old) => ++old);
#endif #endif

View file

@ -51,7 +51,7 @@ public sealed class CommandsUtilityService : ICommandsUtilityService, IEService
.WithFooter(GetText(strs.module(com.Module.GetTopLevelModule().Name), guild)) .WithFooter(GetText(strs.module(com.Module.GetTopLevelModule().Name), guild))
.WithOkColor(); .WithOkColor();
var opt = GetNadekoOptionType(com.Attributes); var opt = GetEllieOptionType(com.Attributes);
if (opt is not null) if (opt is not null)
{ {
var hs = GetCommandOptionHelp(opt); var hs = GetCommandOptionHelp(opt);
@ -90,11 +90,11 @@ public sealed class CommandsUtilityService : ICommandsUtilityService, IEService
return strs; return strs;
} }
public static Type? GetNadekoOptionType(IEnumerable<Attribute> attributes) public static Type? GetEllieOptionType(IEnumerable<Attribute> attributes)
=> attributes => attributes
.Select(a => a.GetType()) .Select(a => a.GetType())
.Where(a => a.IsGenericType .Where(a => a.IsGenericType
&& a.GetGenericTypeDefinition() == typeof(NadekoOptionsAttribute<>)) && a.GetGenericTypeDefinition() == typeof(EllieOptionsAttribute<>))
.Select(a => a.GenericTypeArguments[0]) .Select(a => a.GenericTypeArguments[0])
.FirstOrDefault(); .FirstOrDefault();

View file

@ -3,7 +3,7 @@ using Humanizer.Localisation;
using Ellie.Common.ModuleBehaviors; using Ellie.Common.ModuleBehaviors;
using System.Diagnostics; using System.Diagnostics;
namespace NadekoBot.Services; namespace Ellie.Services;
public sealed class StatsService : IStatsService, IReadyExecutor, IEService public sealed class StatsService : IStatsService, IReadyExecutor, IEService
{ {

View file

@ -87,7 +87,7 @@ public class BotStrings : IBotStrings
} }
// Log.Warning(@"'{CommandName}' command strings don't exist in '{LanguageName}' culture. // Log.Warning(@"'{CommandName}' command strings don't exist in '{LanguageName}' culture.
// This message is safe to ignore, however you can ask in Nadeko support server how you can contribute command translations", // This message is safe to ignore, however you can ask in Ellie support server how you can contribute command translations",
// commandName, cultureInfo.Name); // commandName, cultureInfo.Name);
return GetCommandStrings(commandName, _usCultureInfo); return GetCommandStrings(commandName, _usCultureInfo);

View file

@ -1,7 +1,7 @@
// Code temporarily yeeted from // Code temporarily yeeted from
// https://github.com/mostmand/Cloneable/blob/master/Cloneable/CloneableGenerator.cs // https://github.com/mostmand/Cloneable/blob/master/Cloneable/CloneableGenerator.cs
// because of NRT issue // because of NRT issue
#nullable disable #nullable enable
using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax; using Microsoft.CodeAnalysis.CSharp.Syntax;

View file

@ -1,6 +1,6 @@
# Coordinator project # Coordinator project
Grpc-based coordinator useful for sharded NadekoBot. Its purpose is controlling the lifetime and checking status of the shards it creates. Grpc-based coordinator useful for sharded Ellie. Its purpose is controlling the lifetime and checking status of the shards it creates.
### Supports ### Supports

View file

@ -88,7 +88,7 @@ namespace Ellie.Coordinator
lock (locker) lock (locker)
{ {
var shardIds = Enumerable.Range(0, 1) // shard 0 is always first var shardIds = Enumerable.Range(0, 1) // shard 0 is always first
.Append((int)((117523346618318850 >> 22) % _config.TotalShards)) // then nadeko server shard .Append((int)((117523346618318850 >> 22) % _config.TotalShards)) // then ellie server shard
.Concat(Enumerable.Range(1, _config.TotalShards - 1) .Concat(Enumerable.Range(1, _config.TotalShards - 1)
.OrderBy(_ => _rng.Next())) // then all other shards in a random order .OrderBy(_ => _rng.Next())) // then all other shards in a random order
.Distinct() .Distinct()