mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 09:18:27 -04:00
- Updated changelog
- Updated all projects to .net6 - Added some exception handling to the cmd source generator
This commit is contained in:
@@ -8,12 +8,11 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
|
||||
## Changes
|
||||
|
||||
### Added
|
||||
|
||||
- Added `.deleteemptyservers` command
|
||||
- Added `.curtr <id>` which lets you see full information about one of your own transactions with the specified id
|
||||
- Added trovo.live support for stream notifications (`.stadd`)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed an extra whitespace in usage part of command help if the command has no arguments
|
||||
- Possible small fix for `.prune` ratelimiting
|
||||
- `.gvc` should now properly trigger when a user is already in a gvc and changes his activity
|
||||
@@ -21,7 +20,6 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
|
||||
- Fixed reference to non-existent command in bot.yml
|
||||
|
||||
### Changed
|
||||
|
||||
- CustomReactions module (and customreactions db table) has been renamed to Expressions.
|
||||
- This was done to remove confusion about how it relates to discord Reactions (it doesn't, it was created and named before discord reactions existed)
|
||||
- Expression command now start with ex/expr and end with the name of the action or setting.
|
||||
@@ -31,6 +29,7 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
|
||||
- If you have custom permissions for other CustomReaction commands
|
||||
- Some of the old aliases like `.acr` `.dcr` `.lcr` and a few others have been kept
|
||||
- Currency output format improvement (will use guild locale now for some commands)
|
||||
- `.crypto` will now also show CoinMarketCap rank
|
||||
- Improved .curtrs (It will now have a lot more useful data in the database, show Tx ids, and be partially localized)
|
||||
- [dev] Reason renamed to Note
|
||||
- [dev] Added Type, Extra, OtherId fields to the database
|
||||
@@ -41,7 +40,6 @@ Experimental changelog. Mostly based on [keepachangelog](https://keepachangelog.
|
||||
- [dev] Moved FilterWordsChannelId to a separate table
|
||||
|
||||
### Removed
|
||||
|
||||
- Removed `.bce` - use `.config` or `.config bot` specifically for bot config
|
||||
- Removed obsolete placeholders: %users% %servers% %userfull% %username% %userdiscrim% %useravatar% %id% %uid% %chname% %cid% %sid% %members% %server_time% %shardid% %time% %mention%
|
||||
- Removed some obsolete commands and strings
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@@ -310,7 +310,7 @@ namespace NadekoBot.Coordinator
|
||||
})
|
||||
.ToList()
|
||||
};
|
||||
var jsonState = JsonSerializer.Serialize(coordState, new ()
|
||||
var jsonState = JsonSerializer.Serialize(coordState, new JsonSerializerOptions()
|
||||
{
|
||||
WriteIndented = true,
|
||||
});
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using System.CodeDom.Compiler;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
@@ -62,6 +63,9 @@ public class CmdAttribute : System.Attribute
|
||||
|
||||
public void Initialize(IncrementalGeneratorInitializationContext context)
|
||||
{
|
||||
// #if DEBUG
|
||||
// SpinWait.SpinUntil(() => Debugger.IsAttached);
|
||||
// #endif
|
||||
context.RegisterPostInitializationOutput(static ctx => ctx.AddSource(
|
||||
"CmdAttribute.g.cs",
|
||||
SourceText.From(ATTRIBUTE, Encoding.UTF8)));
|
||||
@@ -90,9 +94,17 @@ public class CmdAttribute : System.Attribute
|
||||
|
||||
foreach (var model in models)
|
||||
{
|
||||
var source = GetSourceText(model);
|
||||
ctx.AddSource($"{model.Namespace}.{string.Join(".", model.ClassHierarchy)}.g.cs",
|
||||
SourceText.From(source, Encoding.UTF8));
|
||||
var name = $"{model.Namespace}.{string.Join(".", model.ClassHierarchy)}.g.cs";
|
||||
try
|
||||
{
|
||||
Debug.WriteLine($"Writing {name}");
|
||||
var source = GetSourceText(model);
|
||||
ctx.AddSource(name, SourceText.From(source, Encoding.UTF8));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.WriteLine($"Error writing source file {name}\n" + ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,25 +238,6 @@ public class CmdAttribute : System.Attribute
|
||||
return methodModel;
|
||||
}
|
||||
|
||||
// private static IEnumerable<string> GetParams(Compilation compilation, MethodDeclarationSyntax method)
|
||||
// {
|
||||
// var semModel = compilation.GetSemanticModel(method.SyntaxTree);
|
||||
// return method.ParameterList.Parameters.Select(p =>
|
||||
// {
|
||||
// var prefix = string.Empty;
|
||||
//
|
||||
// var typeSymbol = semModel.GetTypeInfo(p).Type;
|
||||
//
|
||||
// if (p.Modifiers.Any(static x => x.IsKind(SyntaxKind.ParamsKeyword)))
|
||||
// prefix += "params ";
|
||||
// return prefix + $"{typeSymbol?.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat)} {p.Identifier.ToString()}";
|
||||
// });
|
||||
// // foreach (var param in method.ParameterList.Parameters)
|
||||
// // {
|
||||
// // yield return param.ToString();
|
||||
// // }
|
||||
// }
|
||||
|
||||
//https://github.com/andrewlock/NetEscapades.EnumGenerators/blob/main/src/NetEscapades.EnumGenerators/EnumGenerator.cs
|
||||
static string? GetNamespace(MethodDeclarationSyntax declarationSyntax)
|
||||
{
|
||||
@@ -308,7 +301,7 @@ public class CmdAttribute : System.Attribute
|
||||
if (cancel.IsCancellationRequested)
|
||||
return default;
|
||||
|
||||
var symbol = ModelExtensions.GetSymbolInfo(ctx.SemanticModel, attSyntax).Symbol;
|
||||
var symbol = ctx.SemanticModel.GetSymbolInfo(attSyntax).Symbol;
|
||||
if (symbol is not IMethodSymbol attSymbol)
|
||||
continue;
|
||||
|
||||
|
@@ -1,9 +1,10 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||
<IsRoslynComponent>true</IsRoslynComponent>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@@ -23,6 +23,8 @@ public sealed class Bot
|
||||
|
||||
public string Mention { get; private set; }
|
||||
public bool IsReady { get; private set; }
|
||||
public int ShardId { get; set; }
|
||||
|
||||
private readonly IBotCredentials _creds;
|
||||
private readonly CommandService _commandService;
|
||||
private readonly DbService _db;
|
||||
@@ -34,6 +36,7 @@ public sealed class Bot
|
||||
if (shardId < 0)
|
||||
throw new ArgumentOutOfRangeException(nameof(shardId));
|
||||
|
||||
ShardId = shardId;
|
||||
_credsProvider = new BotCredsProvider(totalShards);
|
||||
_creds = _credsProvider.GetCreds();
|
||||
|
||||
@@ -64,6 +67,7 @@ public sealed class Bot
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
public List<ulong> GetCurrentGuildIds()
|
||||
=> Client.Guilds.Select(x => x.Id).ToList();
|
||||
|
||||
|
Reference in New Issue
Block a user