nadekobot almost builds
@@ -41,6 +41,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Bot.Db", "src\Nadeko
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Bot.Common", "src\Nadeko.Bot.Common\Nadeko.Bot.Common.csproj", "{02ABC10E-3323-4698-A388-C61D7D03797E}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Nadeko.Bot.Generators.Cloneable", "src\Nadeko.Bot.Generators.Cloneable\Nadeko.Bot.Generators.Cloneable.csproj", "{A5E71EE3-786E-438C-95C0-5BC558FCECCF}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -120,6 +122,12 @@ Global
|
||||
{02ABC10E-3323-4698-A388-C61D7D03797E}.GlobalNadeko|Any CPU.Build.0 = Debug|Any CPU
|
||||
{02ABC10E-3323-4698-A388-C61D7D03797E}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{02ABC10E-3323-4698-A388-C61D7D03797E}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A5E71EE3-786E-438C-95C0-5BC558FCECCF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A5E71EE3-786E-438C-95C0-5BC558FCECCF}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A5E71EE3-786E-438C-95C0-5BC558FCECCF}.GlobalNadeko|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A5E71EE3-786E-438C-95C0-5BC558FCECCF}.GlobalNadeko|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A5E71EE3-786E-438C-95C0-5BC558FCECCF}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{A5E71EE3-786E-438C-95C0-5BC558FCECCF}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -138,6 +146,7 @@ Global
|
||||
{92E239B9-C230-4475-9506-BED20174FD20} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2}
|
||||
{02499E3E-3B04-4BC8-9B3C-D9494661F78E} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2}
|
||||
{02ABC10E-3323-4698-A388-C61D7D03797E} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2}
|
||||
{A5E71EE3-786E-438C-95C0-5BC558FCECCF} = {04929013-5BAB-42B0-B9B2-8F2BB8F16AF2}
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {5F3F555C-855F-4BE8-B526-D062D3E8ACA4}
|
||||
|
@@ -5,7 +5,7 @@ public interface IBotCredentials
|
||||
{
|
||||
string Token { get; }
|
||||
string GoogleApiKey { get; }
|
||||
ICollection<ulong> OwnerIds { get; }
|
||||
ICollection<ulong> OwnerIds { get; set; }
|
||||
bool UsePrivilegedIntents { get; }
|
||||
string RapidApiKey { get; }
|
||||
|
||||
|
13
src/Nadeko.Bot.Common/Abstractions/strings/CommandStrings.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
#nullable disable
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace NadekoBot.Services;
|
||||
|
||||
public sealed class CommandStrings
|
||||
{
|
||||
[YamlMember(Alias = "desc")]
|
||||
public string Desc { get; set; }
|
||||
|
||||
[YamlMember(Alias = "args")]
|
||||
public string[] Args { get; set; }
|
||||
}
|
@@ -12,6 +12,6 @@ public interface IBotStrings
|
||||
string GetText(string key, ulong? guildId = null, params object[] data);
|
||||
string GetText(string key, CultureInfo locale, params object[] data);
|
||||
void Reload();
|
||||
ICommandStrings GetCommandStrings(string commandName, ulong? guildId = null);
|
||||
ICommandStrings GetCommandStrings(string commandName, CultureInfo cultureInfo);
|
||||
CommandStrings GetCommandStrings(string commandName, ulong? guildId = null);
|
||||
CommandStrings GetCommandStrings(string commandName, CultureInfo cultureInfo);
|
||||
}
|
@@ -24,5 +24,5 @@ public interface IBotStringsProvider
|
||||
/// </summary>
|
||||
/// <param name="localeName">Language name</param>
|
||||
/// <param name="commandName">Command name</param>
|
||||
ICommandStrings GetCommandStrings(string localeName, string commandName);
|
||||
CommandStrings GetCommandStrings(string localeName, string commandName);
|
||||
}
|
@@ -1,8 +0,0 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Services;
|
||||
|
||||
public interface ICommandStrings
|
||||
{
|
||||
string Desc { get; set; }
|
||||
string[] Args { get; set; }
|
||||
}
|
@@ -1,4 +1,5 @@
|
||||
#nullable disable
|
||||
|
||||
namespace NadekoBot.Services;
|
||||
|
||||
/// <summary>
|
||||
@@ -12,5 +13,5 @@ public interface IStringsSource
|
||||
/// <returns>Dictionary(localename, Dictionary(key, response))</returns>
|
||||
Dictionary<string, Dictionary<string, string>> GetResponseStrings();
|
||||
|
||||
Dictionary<string, Dictionary<string, ICommandStrings>> GetCommandStrings();
|
||||
Dictionary<string, Dictionary<string, CommandStrings>> GetCommandStrings();
|
||||
}
|
@@ -1,13 +1,13 @@
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public readonly struct LocStr
|
||||
{
|
||||
public readonly string Key;
|
||||
public readonly object[] Params;
|
||||
|
||||
public LocStr(string key, params object[] data)
|
||||
{
|
||||
Key = key;
|
||||
Params = data;
|
||||
}
|
||||
}
|
||||
// namespace NadekoBot.Common;
|
||||
//
|
||||
// public readonly struct LocStr
|
||||
// {
|
||||
// public readonly string Key;
|
||||
// public readonly object[] Params;
|
||||
//
|
||||
// public LocStr(string key, params object[] data)
|
||||
// {
|
||||
// Key = key;
|
||||
// Params = data;
|
||||
// }
|
||||
// }
|
@@ -4,7 +4,6 @@ using Cloneable;
|
||||
using NadekoBot.Common.Yml;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using System.Globalization;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using YamlDotNet.Core;
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
|
@@ -7,6 +7,6 @@ namespace NadekoBot.Extensions;
|
||||
|
||||
public static class DbExtensions
|
||||
{
|
||||
public static DiscordUser GetOrCreateUser(this NadekoContext ctx, IUser original, Func<IQueryable<DiscordUser>, IQueryable<DiscordUser>> includes = null)
|
||||
public static DiscordUser GetOrCreateUser(this NadekoContext ctx, IUser original, Func<IQueryable<DiscordUser>, IQueryable<DiscordUser>>? includes = null)
|
||||
=> ctx.GetOrCreateUser(original.Id, original.Username, original.Discriminator, original.AvatarId, includes);
|
||||
}
|
@@ -4,7 +4,6 @@
|
||||
<TargetFramework>net7.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<RunAnalyzersDuringBuild>false</RunAnalyzersDuringBuild>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -25,5 +24,14 @@
|
||||
<Publish>True</Publish>
|
||||
</PackageReference>
|
||||
<ProjectReference Include="..\Nadeko.Medusa\Nadeko.Medusa.csproj" />
|
||||
|
||||
<ProjectReference Include="..\NadekoBot.Generators\NadekoBot.Generators.csproj" OutputItemType="Analyzer" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Update="data\**\*">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<AdditionalFiles Include="data\strings\responses\responses.en-US.json" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#nullable disable
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
using System.Text.RegularExpressions;
|
||||
using NonBlocking;
|
||||
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
@@ -59,19 +59,20 @@ public class ReplacementBuilder
|
||||
_reps.TryAdd("%server.members%", () => g is { } sg ? sg.MemberCount.ToString() : "?");
|
||||
_reps.TryAdd("%server.boosters%", () => g.PremiumSubscriptionCount.ToString());
|
||||
_reps.TryAdd("%server.boost_level%", () => ((int)g.PremiumTier).ToString());
|
||||
_reps.TryAdd("%server.time%",
|
||||
() =>
|
||||
{
|
||||
var to = TimeZoneInfo.Local;
|
||||
if (g is not null)
|
||||
{
|
||||
if (GuildTimezoneService.AllServices.TryGetValue(client.CurrentUser.Id, out var tz))
|
||||
to = tz.GetTimeZoneOrDefault(g.Id) ?? TimeZoneInfo.Local;
|
||||
}
|
||||
|
||||
return TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.Utc, to).ToString("HH:mm ")
|
||||
+ to.StandardName.GetInitials();
|
||||
});
|
||||
// todo fix
|
||||
// _reps.TryAdd("%server.time%",
|
||||
// () =>
|
||||
// {
|
||||
// var to = TimeZoneInfo.Local;
|
||||
// if (g is not null)
|
||||
// {
|
||||
// if (GuildTimezoneService.AllServices.TryGetValue(client.CurrentUser.Id, out var tz))
|
||||
// to = tz.GetTimeZoneOrDefault(g.Id) ?? TimeZoneInfo.Local;
|
||||
// }
|
||||
//
|
||||
// return TimeZoneInfo.ConvertTime(DateTime.UtcNow, TimeZoneInfo.Utc, to).ToString("HH:mm ")
|
||||
// + to.StandardName.GetInitials();
|
||||
// });
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,15 @@
|
||||
namespace NadekoBot.Services;
|
||||
using NadekoBot.Modules.Administration;
|
||||
using NonBlocking;
|
||||
|
||||
namespace NadekoBot.Services;
|
||||
|
||||
public interface ICommandHandler
|
||||
{
|
||||
string GetPrefix(IGuild ctxGuild);
|
||||
string GetPrefix(ulong? id = null);
|
||||
string SetDefaultPrefix(string toSet);
|
||||
string SetPrefix(IGuild ctxGuild, string toSet);
|
||||
ConcurrentDictionary<ulong, uint> UserMessagesSent { get; }
|
||||
|
||||
Task TryRunCommand(SocketGuild guild, ISocketMessageChannel channel, IUserMessage usrMsg);
|
||||
}
|
@@ -2,7 +2,6 @@ using NadekoBot.Common.Configs;
|
||||
using NadekoBot.Common.Yml;
|
||||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Common;
|
||||
|
||||
namespace NadekoBot.Services;
|
||||
|
23
src/Nadeko.Bot.Common/TypeReaders/CommandOrExprInfo.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
#nullable disable
|
||||
namespace NadekoBot.Common.TypeReaders;
|
||||
|
||||
public class CommandOrExprInfo
|
||||
{
|
||||
public enum Type
|
||||
{
|
||||
Normal,
|
||||
Custom
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
public Type CmdType { get; set; }
|
||||
|
||||
public bool IsCustom
|
||||
=> CmdType == Type.Custom;
|
||||
|
||||
public CommandOrExprInfo(string input, Type type)
|
||||
{
|
||||
Name = input;
|
||||
CmdType = type;
|
||||
}
|
||||
}
|
@@ -15,7 +15,7 @@ public static class ReflectionExtensions
|
||||
if (givenType.IsGenericType && givenType.GetGenericTypeDefinition() == genericType)
|
||||
return true;
|
||||
|
||||
Type baseType = givenType.BaseType;
|
||||
var baseType = givenType.BaseType;
|
||||
if (baseType == null) return false;
|
||||
|
||||
return IsAssignableToGenericType(baseType, genericType);
|
||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.7 KiB After Width: | Height: | Size: 4.7 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.1 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 5.5 KiB After Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 4.5 KiB After Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 4.3 KiB |
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 9.5 KiB After Width: | Height: | Size: 9.5 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 8.9 KiB After Width: | Height: | Size: 8.9 KiB |
Before Width: | Height: | Size: 9.1 KiB After Width: | Height: | Size: 9.1 KiB |
Before Width: | Height: | Size: 9.2 KiB After Width: | Height: | Size: 9.2 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 7.0 KiB After Width: | Height: | Size: 7.0 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 6.4 KiB After Width: | Height: | Size: 6.4 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 9.4 KiB After Width: | Height: | Size: 9.4 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 5.7 KiB After Width: | Height: | Size: 5.7 KiB |
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.6 KiB |
Before Width: | Height: | Size: 6.0 KiB After Width: | Height: | Size: 6.0 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
Before Width: | Height: | Size: 7.2 KiB After Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.6 KiB After Width: | Height: | Size: 7.6 KiB |
Before Width: | Height: | Size: 6.7 KiB After Width: | Height: | Size: 6.7 KiB |
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.0 KiB |
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 3.8 KiB |
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
Before Width: | Height: | Size: 3.9 KiB After Width: | Height: | Size: 3.9 KiB |
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 49 KiB |
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
1
src/Nadeko.Bot.Common/data/last_known_version.txt
Normal file
@@ -0,0 +1 @@
|
||||
4.3.13
|