diff --git a/src/NadekoBot/Common/Medusa/TypeWrapper.cs b/src/NadekoBot/Common/Medusa/TypeWrapper.cs new file mode 100644 index 000000000..fb6b3e1a5 --- /dev/null +++ b/src/NadekoBot/Common/Medusa/TypeWrapper.cs @@ -0,0 +1,143 @@ +using System.Globalization; +using System.Reflection; + +namespace Nadeko.Medusa; + +public sealed class TypeWrapper : Type +{ + private readonly int _hashCode; + + public TypeWrapper(Type t) + { + _hashCode = t.GetHashCode(); + Namespace = t.Namespace; + Name = t.Name; + FullName = t.FullName; + IsGenericType = t.IsGenericType; + IsConstructedGenericType = t.IsConstructedGenericType; + } + + public override bool IsGenericType { get; } + public override bool IsConstructedGenericType { get; } + + public override object[] GetCustomAttributes(bool inherit) + => throw new NotImplementedException(); + + public override object[] GetCustomAttributes(Type attributeType, bool inherit) + => throw new NotImplementedException(); + + public override bool IsDefined(Type attributeType, bool inherit) + => throw new NotImplementedException(); + + public override Module Module { get; } + public override string? Namespace { get; } + public override string Name { get; } + + protected override TypeAttributes GetAttributeFlagsImpl() + => throw new NotImplementedException(); + + protected override ConstructorInfo? GetConstructorImpl( + BindingFlags bindingAttr, + Binder? binder, + CallingConventions callConvention, + Type[] types, + ParameterModifier[]? modifiers) + => throw new NotImplementedException(); + + public override ConstructorInfo[] GetConstructors(BindingFlags bindingAttr) + => throw new NotImplementedException(); + + public override Type? GetElementType() + => throw new NotImplementedException(); + + public override EventInfo? GetEvent(string name, BindingFlags bindingAttr) + => throw new NotImplementedException(); + + public override EventInfo[] GetEvents(BindingFlags bindingAttr) + => throw new NotImplementedException(); + + public override FieldInfo? GetField(string name, BindingFlags bindingAttr) + => throw new NotImplementedException(); + + public override FieldInfo[] GetFields(BindingFlags bindingAttr) + => throw new NotImplementedException(); + + public override MemberInfo[] GetMembers(BindingFlags bindingAttr) + => throw new NotImplementedException(); + + protected override MethodInfo? GetMethodImpl( + string name, + BindingFlags bindingAttr, + Binder? binder, + CallingConventions callConvention, + Type[]? types, + ParameterModifier[]? modifiers) + => throw new NotImplementedException(); + + public override MethodInfo[] GetMethods(BindingFlags bindingAttr) + => throw new NotImplementedException(); + + public override PropertyInfo[] GetProperties(BindingFlags bindingAttr) + => throw new NotImplementedException(); + + public override object? InvokeMember( + string name, + BindingFlags invokeAttr, + Binder? binder, + object? target, + object?[]? args, + ParameterModifier[]? modifiers, + CultureInfo? culture, + string[]? namedParameters) + => throw new NotImplementedException(); + + public override Type UnderlyingSystemType { get; } + + protected override bool IsArrayImpl() + => throw new NotImplementedException(); + + protected override bool IsByRefImpl() + => throw new NotImplementedException(); + + protected override bool IsCOMObjectImpl() + => throw new NotImplementedException(); + + protected override bool IsPointerImpl() + => throw new NotImplementedException(); + + protected override bool IsPrimitiveImpl() + => throw new NotImplementedException(); + + public override Assembly Assembly { get; } + public override string? AssemblyQualifiedName { get; } + public override Type? BaseType { get; } + public override string? FullName { get; } + public override Guid GUID { get; } + + protected override PropertyInfo? GetPropertyImpl( + string name, + BindingFlags bindingAttr, + Binder? binder, + Type? returnType, + Type[]? types, + ParameterModifier[]? modifiers) + => throw new NotImplementedException(); + + protected override bool HasElementTypeImpl() + => throw new NotImplementedException(); + + public override Type? GetNestedType(string name, BindingFlags bindingAttr) + => throw new NotImplementedException(); + + public override Type[] GetNestedTypes(BindingFlags bindingAttr) + => throw new NotImplementedException(); + + public override int GetHashCode() + => _hashCode; + + public override Type? GetInterface(string name, bool ignoreCase) + => throw new NotImplementedException(); + + public override Type[] GetInterfaces() + => throw new NotImplementedException(); +} \ No newline at end of file diff --git a/src/NadekoBot/Modules/Searches/Translate/TranslateService.cs b/src/NadekoBot/Modules/Searches/Translate/TranslateService.cs index 68588e955..9f0e91a53 100644 --- a/src/NadekoBot/Modules/Searches/Translate/TranslateService.cs +++ b/src/NadekoBot/Modules/Searches/Translate/TranslateService.cs @@ -220,5 +220,5 @@ public sealed class TranslateService : ITranslateService, IExecNoCommand, IReady } public IEnumerable GetLanguages() - => _google.Languages.Select(x => x.Key); + => _google.Languages.GroupBy(x => x.Value).Select(x => $"{x.AsEnumerable().Select(y => y.Key).Join(", ")}"); } \ No newline at end of file diff --git a/src/NadekoBot/Services/Impl/GoogleApiService.cs b/src/NadekoBot/Services/Impl/GoogleApiService.cs index 5191276f7..1fd19f23b 100644 --- a/src/NadekoBot/Services/Impl/GoogleApiService.cs +++ b/src/NadekoBot/Services/Impl/GoogleApiService.cs @@ -27,9 +27,8 @@ public class GoogleApiService : IGoogleApiService, INService { "bengali", "bn" }, { "bulgarian", "bg" }, { "catalan", "ca" }, - { "chinese-traditional", "zh-TW" }, - { "chinese-simplified", "zh-CN" }, { "chinese", "zh-CN" }, + { "chinese-trad", "zh-TW" }, { "croatian", "hr" }, { "czech", "cs" }, { "danish", "da" }, diff --git a/src/NadekoBot/_Extensions/IMessageChannelExtensions.cs b/src/NadekoBot/_Extensions/IMessageChannelExtensions.cs index ab22803e5..0fdc733c2 100644 --- a/src/NadekoBot/_Extensions/IMessageChannelExtensions.cs +++ b/src/NadekoBot/_Extensions/IMessageChannelExtensions.cs @@ -159,7 +159,7 @@ public static class MessageChannelExtensions IEnumerable items, Func howToPrint, int columns = 3) - => ch.SendMessageAsync($@"{seed}```css + => ch.SendMessageAsync($@"{seed}```xl {items.Chunk(columns) .Select(ig => string.Concat(ig.Select(howToPrint))) .Join("\n")}