mirror of
https://gitlab.com/Kwoth/nadekobot.git
synced 2025-09-10 17:28:27 -04:00
Global usings and file scoped namespaces
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<LangVersion>10.0</LangVersion>
|
||||
<EnablePreviewFeatures>True</EnablePreviewFeatures>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@@ -6,11 +6,8 @@ using NadekoBot.Common;
|
||||
using NadekoBot.Services;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
using NadekoBot.Extensions;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
@@ -19,11 +16,9 @@ using NadekoBot.Common.ModuleBehaviors;
|
||||
using NadekoBot.Common.Configs;
|
||||
using NadekoBot.Db;
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
using NadekoBot.Modules.Searches;
|
||||
using Serilog;
|
||||
|
||||
namespace NadekoBot
|
||||
{
|
||||
namespace NadekoBot;
|
||||
|
||||
public sealed class Bot
|
||||
{
|
||||
private readonly IBotCredentials _creds;
|
||||
@@ -362,4 +357,3 @@ namespace NadekoBot
|
||||
await Task.Delay(-1).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public class AsyncLazy<T> : Lazy<Task<T>>
|
||||
{
|
||||
public AsyncLazy(Func<T> valueFactory) :
|
||||
@@ -16,5 +15,3 @@ namespace NadekoBot.Common
|
||||
|
||||
public TaskAwaiter<T> GetAwaiter() { return Value.GetAwaiter(); }
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -1,12 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Services;
|
||||
namespace NadekoBot.Common.Attributes
|
||||
{
|
||||
|
||||
namespace NadekoBot.Common.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class AliasesAttribute : AliasAttribute
|
||||
{
|
||||
@@ -15,4 +11,3 @@ namespace NadekoBot.Common.Attributes
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using Discord.Commands;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
namespace Discord;
|
||||
|
||||
public class BotPermAttribute : RequireBotPermissionAttribute
|
||||
{
|
||||
public BotPermAttribute(GuildPerm permission) : base((GuildPermission)permission)
|
||||
@@ -12,4 +12,3 @@ namespace Discord
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
|
||||
namespace NadekoBot.Common.Attributes;
|
||||
|
||||
namespace NadekoBot.Common.Attributes
|
||||
{
|
||||
public static class CommandNameLoadHelper
|
||||
{
|
||||
|
||||
@@ -33,4 +30,3 @@ namespace NadekoBot.Common.Attributes
|
||||
return toReturn;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,10 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Services;
|
||||
using Discord.Commands;
|
||||
|
||||
namespace NadekoBot.Common.Attributes;
|
||||
|
||||
namespace NadekoBot.Common.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class DescriptionAttribute : SummaryAttribute
|
||||
{
|
||||
@@ -13,4 +10,3 @@ namespace NadekoBot.Common.Attributes
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
namespace Discord.Commands
|
||||
{
|
||||
namespace Discord.Commands;
|
||||
|
||||
public class LeftoverAttribute : RemainderAttribute
|
||||
{
|
||||
public LeftoverAttribute()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,8 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Services;
|
||||
|
||||
namespace NadekoBot.Common.Attributes
|
||||
{
|
||||
namespace NadekoBot.Common.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class NadekoCommandAttribute : CommandAttribute
|
||||
{
|
||||
@@ -16,4 +14,3 @@ namespace NadekoBot.Common.Attributes
|
||||
|
||||
public string MethodName { get; }
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using Discord.Commands;
|
||||
using Discord.Commands;
|
||||
|
||||
namespace NadekoBot.Common.Attributes;
|
||||
|
||||
namespace NadekoBot.Common.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
sealed class NadekoModuleAttribute : GroupAttribute
|
||||
{
|
||||
@@ -10,5 +9,3 @@ namespace NadekoBot.Common.Attributes
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
namespace NadekoBot.Common.Attributes;
|
||||
|
||||
namespace NadekoBot.Common.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class NadekoOptionsAttribute : Attribute
|
||||
{
|
||||
@@ -12,4 +10,3 @@ namespace NadekoBot.Common.Attributes
|
||||
this.OptionType = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +1,11 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Services;
|
||||
|
||||
namespace NadekoBot.Common.Attributes
|
||||
{
|
||||
namespace NadekoBot.Common.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
|
||||
public sealed class OwnerOnlyAttribute : PreconditionAttribute
|
||||
{
|
||||
@@ -17,4 +16,3 @@ namespace NadekoBot.Common.Attributes
|
||||
return Task.FromResult((creds.IsOwner(context.User) || context.Client.CurrentUser.Id == context.User.Id ? PreconditionResult.FromSuccess() : PreconditionResult.FromError("Not owner")));
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +1,10 @@
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Services;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace NadekoBot.Common.Attributes
|
||||
{
|
||||
namespace NadekoBot.Common.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class RatelimitAttribute : PreconditionAttribute
|
||||
{
|
||||
@@ -35,4 +34,3 @@ namespace NadekoBot.Common.Attributes
|
||||
return Task.FromResult(PreconditionResult.FromError(msgContent));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Services;
|
||||
using Newtonsoft.Json;
|
||||
using Discord.Commands;
|
||||
|
||||
namespace NadekoBot.Common.Attributes;
|
||||
|
||||
namespace NadekoBot.Common.Attributes
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
public sealed class UsageAttribute : RemarksAttribute
|
||||
{
|
||||
@@ -18,4 +14,3 @@ namespace NadekoBot.Common.Attributes
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
namespace Discord;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
|
||||
public class UserPermAttribute : PreconditionAttribute
|
||||
{
|
||||
@@ -30,4 +29,3 @@ namespace Discord
|
||||
return UserPermissionAttribute.CheckPermissionsAsync(context, command, services);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public class CmdStrings
|
||||
{
|
||||
public string[] Usages { get; }
|
||||
@@ -17,4 +17,3 @@ namespace NadekoBot.Common
|
||||
Description = description;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,15 +1,12 @@
|
||||
// License MIT
|
||||
// Source: https://github.com/i3arnon/ConcurrentHashSet
|
||||
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
|
||||
namespace NadekoBot.Common.Collections
|
||||
{
|
||||
namespace NadekoBot.Common.Collections;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a thread-safe hash-based unique collection.
|
||||
/// </summary>
|
||||
@@ -769,4 +766,3 @@ namespace NadekoBot.Common.Collections
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections;
|
||||
|
||||
namespace NadekoBot.Common.Collections;
|
||||
|
||||
namespace NadekoBot.Common.Collections
|
||||
{
|
||||
public static class DisposableReadOnlyListExtensions
|
||||
{
|
||||
public static IDisposableReadOnlyList<T> AsDisposable<T>(this IReadOnlyList<T> arr) where T : IDisposable
|
||||
@@ -74,4 +72,3 @@ namespace NadekoBot.Common.Collections
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,8 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
|
||||
namespace NadekoBot.Common.Collections
|
||||
{
|
||||
namespace NadekoBot.Common.Collections;
|
||||
|
||||
public class IndexedCollection<T> : IList<T> where T : class, IIndexed
|
||||
{
|
||||
public List<T> Source { get; }
|
||||
@@ -138,4 +136,3 @@ namespace NadekoBot.Common.Collections
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public class CommandData
|
||||
{
|
||||
public string Cmd { get; set; }
|
||||
public string Desc { get; set; }
|
||||
public string[] Usage { get; set; }
|
||||
}
|
||||
}
|
||||
|
@@ -1,13 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Globalization;
|
||||
using Cloneable;
|
||||
using NadekoBot.Common.Yml;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using YamlDotNet.Core;
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace NadekoBot.Common.Configs
|
||||
{
|
||||
namespace NadekoBot.Common.Configs;
|
||||
|
||||
[Cloneable]
|
||||
public sealed partial class BotConfig : ICloneable<BotConfig>
|
||||
{
|
||||
@@ -181,4 +180,3 @@ See RotatingStatuses submodule in Administration.")]
|
||||
Simple = 1,
|
||||
None = 2,
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
namespace NadekoBot.Common.Configs
|
||||
{
|
||||
namespace NadekoBot.Common.Configs;
|
||||
|
||||
/// <summary>
|
||||
/// Base interface for available config serializers
|
||||
/// </summary>
|
||||
@@ -15,4 +15,3 @@
|
||||
/// </summary>
|
||||
public T Deserialize<T>(string data);
|
||||
}
|
||||
}
|
@@ -1,9 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using NadekoBot.Common.Yml;
|
||||
using YamlDotNet.Serialization;
|
||||
using NadekoBot.Common.Yml;
|
||||
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
public sealed class Creds : IBotCredentials
|
||||
{
|
||||
public Creds()
|
||||
@@ -216,4 +214,3 @@ This should be equivalent to the DiscordsKey in your NadekoBot.Votes api appsett
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +1,11 @@
|
||||
using NadekoBot.Services;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public class DownloadTracker : INService
|
||||
{
|
||||
private ConcurrentDictionary<ulong, DateTime> LastDownloads { get; } = new ConcurrentDictionary<ulong, DateTime>();
|
||||
@@ -40,4 +39,3 @@ namespace NadekoBot.Common
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,9 @@
|
||||
using Discord;
|
||||
using NadekoBot.Common;
|
||||
|
||||
namespace NadekoBot.Extensions
|
||||
{
|
||||
namespace NadekoBot.Extensions;
|
||||
|
||||
public static class BotCredentialsExtensions
|
||||
{
|
||||
public static bool IsOwner(this IBotCredentials creds, IUser user)
|
||||
=> creds.OwnerIds.Contains(user.Id);
|
||||
}
|
||||
}
|
@@ -1,17 +1,14 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Reflection;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using NadekoBot.Common;
|
||||
using NadekoBot.Modules.Music;
|
||||
using NadekoBot.Services;
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
using NadekoBot.Modules.Music.Resolvers;
|
||||
using NadekoBot.Modules.Music.Services;
|
||||
using StackExchange.Redis;
|
||||
|
||||
namespace NadekoBot.Extensions
|
||||
{
|
||||
namespace NadekoBot.Extensions;
|
||||
|
||||
public static class ServiceCollectionExtensions
|
||||
{
|
||||
public static IServiceCollection AddBotStringsServices(this IServiceCollection services, int totalShards)
|
||||
@@ -78,4 +75,3 @@ namespace NadekoBot.Extensions
|
||||
return services;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace Discord
|
||||
{
|
||||
namespace Discord;
|
||||
// just a copy paste from discord.net in order to rename it, for compatibility iwth v3 which is gonna use custom lib
|
||||
|
||||
|
||||
// Summary:
|
||||
// Defines the available permissions for a channel.
|
||||
[Flags]
|
||||
@@ -252,4 +248,3 @@ namespace Discord
|
||||
// Allows management and editing of webhooks.
|
||||
ManageWebhooks = 536870912
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
public static class Helpers
|
||||
{
|
||||
public static void ReadErrorAndExit(int exitCode)
|
||||
@@ -12,4 +10,3 @@ namespace NadekoBot.Common
|
||||
Environment.Exit(exitCode);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Discord;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using NadekoBot.Common;
|
||||
using NadekoBot.Common;
|
||||
|
||||
namespace NadekoBot;
|
||||
|
||||
namespace NadekoBot
|
||||
{
|
||||
public interface IBotCredentials
|
||||
{
|
||||
string Token { get; }
|
||||
@@ -33,4 +29,3 @@ namespace NadekoBot
|
||||
public string Cmd { get; set; }
|
||||
public string Args { get; set; }
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,6 @@
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public interface ICloneable<T> where T : new()
|
||||
{
|
||||
public T Clone();
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
using Discord;
|
||||
|
||||
namespace NadekoBot
|
||||
{
|
||||
namespace NadekoBot;
|
||||
|
||||
public interface IEmbedBuilder
|
||||
{
|
||||
IEmbedBuilder WithDescription(string desc);
|
||||
@@ -22,4 +22,3 @@ namespace NadekoBot
|
||||
Pending,
|
||||
Error,
|
||||
}
|
||||
}
|
@@ -1,7 +1,6 @@
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public interface INadekoCommandOptions
|
||||
{
|
||||
void NormalizeOptions();
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
public interface IPlaceholderProvider
|
||||
{
|
||||
public IEnumerable<(string Name, Func<string> Func)> GetPlaceholders();
|
||||
}
|
||||
}
|
@@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using NadekoBot.Common.Yml;
|
||||
using NadekoBot.Common.Yml;
|
||||
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
public class ImageUrls
|
||||
{
|
||||
[Comment("DO NOT CHANGE")]
|
||||
@@ -47,4 +46,3 @@ namespace NadekoBot.Common
|
||||
public Uri Bg { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,10 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Globalization;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
|
||||
namespace NadekoBot.Common.JsonConverters
|
||||
{
|
||||
namespace NadekoBot.Common.JsonConverters;
|
||||
|
||||
public class Rgba32Converter : JsonConverter<Rgba32>
|
||||
{
|
||||
public override Rgba32 Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
@@ -31,4 +30,3 @@ namespace NadekoBot.Common.JsonConverters
|
||||
writer.WriteStringValue(value.Name);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
// needs proper invalid input check (character array input out of range)
|
||||
// needs negative number support
|
||||
public readonly struct kwum : IEquatable<kwum>
|
||||
@@ -95,4 +94,3 @@ namespace NadekoBot.Common
|
||||
return _value.GetHashCode();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
using CommandLine;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public class LbOpts : INadekoCommandOptions
|
||||
{
|
||||
[Option('c', "clean", Default = false, HelpText = "Only show users who are on the server.")]
|
||||
@@ -11,4 +11,3 @@ namespace NadekoBot.Common
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
using System.Net;
|
||||
using System.Runtime.CompilerServices;
|
||||
using Discord.Net;
|
||||
using Serilog;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public class LoginErrorHandler
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
@@ -54,4 +52,3 @@ namespace NadekoBot.Common
|
||||
Log.Fatal(ex.ToString());
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,8 +1,8 @@
|
||||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
|
||||
namespace NadekoBot.Common.ModuleBehaviors
|
||||
{
|
||||
namespace NadekoBot.Common.ModuleBehaviors;
|
||||
|
||||
/// <summary>
|
||||
/// Implemented by modules which block execution before anything is executed
|
||||
/// </summary>
|
||||
@@ -11,4 +11,3 @@ namespace NadekoBot.Common.ModuleBehaviors
|
||||
int Priority { get; }
|
||||
Task<bool> RunBehavior(IGuild guild, IUserMessage msg);
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,9 @@
|
||||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
|
||||
namespace NadekoBot.Common.ModuleBehaviors
|
||||
{
|
||||
namespace NadekoBot.Common.ModuleBehaviors;
|
||||
|
||||
public interface IInputTransformer
|
||||
{
|
||||
Task<string> TransformInput(IGuild guild, IMessageChannel channel, IUser user, string input);
|
||||
}
|
||||
}
|
||||
|
@@ -1,13 +1,11 @@
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
|
||||
namespace NadekoBot.Common.ModuleBehaviors
|
||||
{
|
||||
namespace NadekoBot.Common.ModuleBehaviors;
|
||||
|
||||
public interface ILateBlocker
|
||||
{
|
||||
public int Priority { get; }
|
||||
|
||||
Task<bool> TryBlockLate(ICommandContext context, string moduleName, CommandInfo command);
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
using System.Threading.Tasks;
|
||||
using Discord;
|
||||
|
||||
namespace NadekoBot.Common.ModuleBehaviors
|
||||
{
|
||||
namespace NadekoBot.Common.ModuleBehaviors;
|
||||
|
||||
/// <summary>
|
||||
/// Last thing to be executed, won't stop further executions
|
||||
/// </summary>
|
||||
@@ -10,4 +10,3 @@ namespace NadekoBot.Common.ModuleBehaviors
|
||||
{
|
||||
Task LateExecute(IGuild guild, IUserMessage msg);
|
||||
}
|
||||
}
|
||||
|
@@ -2,8 +2,8 @@
|
||||
using Discord.WebSocket;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Common.ModuleBehaviors
|
||||
{
|
||||
namespace NadekoBot.Common.ModuleBehaviors;
|
||||
|
||||
public struct ModuleBehaviorResult
|
||||
{
|
||||
public bool Blocked { get; set; }
|
||||
@@ -31,4 +31,3 @@ namespace NadekoBot.Common.ModuleBehaviors
|
||||
int Priority { get; }
|
||||
Task<ModuleBehaviorResult> ApplyBehavior(DiscordSocketClient client, IGuild guild, IUserMessage msg);
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Common.ModuleBehaviors
|
||||
{
|
||||
namespace NadekoBot.Common.ModuleBehaviors;
|
||||
|
||||
/// <summary>
|
||||
/// All services which need to execute something after
|
||||
/// the bot is ready should implement this interface
|
||||
@@ -13,4 +13,3 @@ namespace NadekoBot.Common.ModuleBehaviors
|
||||
/// </summary>
|
||||
public Task OnReadyAsync();
|
||||
}
|
||||
}
|
@@ -6,8 +6,8 @@ using NadekoBot.Extensions;
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Modules
|
||||
{
|
||||
namespace NadekoBot.Modules;
|
||||
|
||||
public abstract class NadekoModule : ModuleBase
|
||||
{
|
||||
protected CultureInfo _cultureInfo { get; set; }
|
||||
@@ -154,4 +154,3 @@ namespace NadekoBot.Modules
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,7 +1,6 @@
|
||||
namespace NadekoBot.Modules
|
||||
{
|
||||
namespace NadekoBot.Modules;
|
||||
|
||||
public static class NadekoModuleExtensions
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
public class NadekoRandom : Random
|
||||
{
|
||||
readonly RandomNumberGenerator _rng;
|
||||
@@ -71,4 +70,3 @@ namespace NadekoBot.Common
|
||||
return BitConverter.ToDouble(bytes, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class)]
|
||||
public sealed class NoPublicBotAttribute : PreconditionAttribute
|
||||
{
|
||||
@@ -16,4 +15,3 @@ namespace NadekoBot.Common
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
public class OldImageUrls
|
||||
{
|
||||
public int Version { get; set; } = 2;
|
||||
@@ -46,4 +44,3 @@ namespace NadekoBot.Common
|
||||
public Uri Bg { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
using CommandLine;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public static class OptionsParser
|
||||
{
|
||||
public static T ParseFrom<T>(string[] args) where T : INadekoCommandOptions, new()
|
||||
@@ -21,4 +21,3 @@ namespace NadekoBot.Common
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public class OsuMapData
|
||||
{
|
||||
public string Title { get; set; }
|
||||
public string Artist { get; set; }
|
||||
public string Version { get; set; }
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public class OsuUserBests
|
||||
{
|
||||
[JsonProperty("beatmap_id")] public string BeatmapId { get; set; }
|
||||
@@ -38,4 +38,3 @@ namespace NadekoBot.Common
|
||||
|
||||
[JsonProperty("replay_available")] public string ReplayAvailable { get; set; }
|
||||
}
|
||||
}
|
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
public static class PlatformHelper
|
||||
{
|
||||
private const int ProcessorCountRefreshIntervalMs = 30000;
|
||||
@@ -22,4 +20,3 @@ namespace NadekoBot.Common
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,8 +1,7 @@
|
||||
namespace NadekoBot.Common.Pokemon
|
||||
{
|
||||
namespace NadekoBot.Common.Pokemon;
|
||||
|
||||
public class PokemonNameId
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace NadekoBot.Common.Pokemon
|
||||
{
|
||||
namespace NadekoBot.Common.Pokemon;
|
||||
|
||||
public class SearchPokemon
|
||||
{
|
||||
public class GenderRatioClass
|
||||
@@ -37,4 +36,3 @@ namespace NadekoBot.Common.Pokemon
|
||||
public string[] Evos { get; set; }
|
||||
public string[] EggGroups { get; set; }
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
namespace NadekoBot.Common.Pokemon
|
||||
{
|
||||
namespace NadekoBot.Common.Pokemon;
|
||||
|
||||
public class SearchPokemonAbility
|
||||
{
|
||||
public string Desc { get; set; }
|
||||
@@ -7,4 +7,3 @@
|
||||
public string Name { get; set; }
|
||||
public float Rating { get; set; }
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
public class EventPubSub : IPubSub
|
||||
{
|
||||
private readonly Dictionary<string, Dictionary<Delegate, List<Func<object, ValueTask>>>> _actions
|
||||
@@ -91,5 +88,3 @@ namespace NadekoBot.Common
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -1,11 +1,9 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
public interface IPubSub
|
||||
{
|
||||
public Task Pub<TData>(in TypedKey<TData> key, TData data);
|
||||
public Task Sub<TData>(in TypedKey<TData> key, Func<TData, ValueTask> action);
|
||||
}
|
||||
}
|
@@ -1,8 +1,7 @@
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public interface ISeria
|
||||
{
|
||||
byte[] Serialize<T>(T data);
|
||||
T Deserialize<T>(byte[] data);
|
||||
}
|
||||
}
|
@@ -1,8 +1,8 @@
|
||||
using System.Text.Json;
|
||||
using NadekoBot.Common.JsonConverters;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public class JsonSeria : ISeria
|
||||
{
|
||||
private JsonSerializerOptions serializerOptions = new JsonSerializerOptions()
|
||||
@@ -25,4 +25,3 @@ namespace NadekoBot.Common
|
||||
return JsonSerializer.Deserialize<T>(data, serializerOptions);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +1,9 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Services;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Extensions;
|
||||
using Serilog;
|
||||
using StackExchange.Redis;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public sealed class RedisPubSub : IPubSub
|
||||
{
|
||||
private readonly ConnectionMultiplexer _multi;
|
||||
@@ -43,4 +40,3 @@ namespace NadekoBot.Common
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public readonly struct TypedKey<TData>
|
||||
{
|
||||
public readonly string Key;
|
||||
@@ -26,4 +26,3 @@
|
||||
|
||||
public override string ToString() => Key;
|
||||
}
|
||||
}
|
@@ -3,8 +3,8 @@ using NadekoBot.Common.Yml;
|
||||
using NadekoBot.Common.Configs;
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public class YamlSeria : IConfigSeria
|
||||
{
|
||||
private readonly ISerializer _serializer;
|
||||
@@ -35,4 +35,3 @@ namespace NadekoBot.Common
|
||||
public T Deserialize<T>(string data)
|
||||
=> _deserializer.Deserialize<T>(data);
|
||||
}
|
||||
}
|
@@ -3,16 +3,11 @@ using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
using NadekoBot.Modules.Music.Services;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using NadekoBot.Common;
|
||||
|
||||
namespace NadekoBot.Common.Replacements
|
||||
{
|
||||
namespace NadekoBot.Common.Replacements;
|
||||
|
||||
public class ReplacementBuilder
|
||||
{
|
||||
private static readonly Regex rngRegex = new Regex("%rng(?:(?<from>(?:-)?\\d+)-(?<to>(?:-)?\\d+))?%", RegexOptions.Compiled);
|
||||
@@ -234,4 +229,3 @@ namespace NadekoBot.Common.Replacements
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace NadekoBot.Common.Replacements;
|
||||
|
||||
namespace NadekoBot.Common.Replacements
|
||||
{
|
||||
public class Replacer
|
||||
{
|
||||
private readonly IEnumerable<(string Key, Func<string> Text)> _replacements;
|
||||
@@ -88,4 +86,3 @@ namespace NadekoBot.Common.Replacements
|
||||
return newEmbedData;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using System;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public class RequireObjectPropertiesContractResolver : DefaultContractResolver
|
||||
{
|
||||
protected override JsonObjectContract CreateObjectContract(Type objectType)
|
||||
@@ -13,4 +12,3 @@ namespace NadekoBot.Common
|
||||
return contract;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
public struct ShmartNumber : IEquatable<ShmartNumber>
|
||||
{
|
||||
public long Value { get; }
|
||||
@@ -60,4 +58,3 @@ namespace NadekoBot.Common
|
||||
return !(left == right);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,8 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Discord;
|
||||
using Discord;
|
||||
using NadekoBot.Extensions;
|
||||
using NadekoBot.Services;
|
||||
|
||||
namespace NadekoBot
|
||||
{
|
||||
namespace NadekoBot;
|
||||
|
||||
public sealed record SmartEmbedText : SmartText
|
||||
{
|
||||
public string PlainText { get; set; }
|
||||
@@ -135,4 +132,3 @@ namespace NadekoBot
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
namespace NadekoBot
|
||||
{
|
||||
namespace NadekoBot;
|
||||
|
||||
public sealed record SmartPlainText : SmartText
|
||||
{
|
||||
public string Text { get; init; }
|
||||
@@ -20,4 +20,3 @@
|
||||
return Text;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,8 +1,7 @@
|
||||
using System;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NadekoBot;
|
||||
|
||||
namespace NadekoBot
|
||||
{
|
||||
public abstract record SmartText
|
||||
{
|
||||
public bool IsEmbed => this is SmartEmbedText;
|
||||
@@ -50,4 +49,3 @@ namespace NadekoBot
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NadekoBot
|
||||
{
|
||||
namespace NadekoBot;
|
||||
|
||||
public class SmartTextEmbedAuthor
|
||||
{
|
||||
public string Name { get; set; }
|
||||
@@ -10,4 +10,3 @@ namespace NadekoBot
|
||||
private string Icon_Url { set => IconUrl = value; }
|
||||
public string Url { get; set; }
|
||||
}
|
||||
}
|
@@ -1,9 +1,8 @@
|
||||
namespace NadekoBot
|
||||
{
|
||||
namespace NadekoBot;
|
||||
|
||||
public class SmartTextEmbedField
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public string Value { get; set; }
|
||||
public bool Inline { get; set; }
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace NadekoBot
|
||||
{
|
||||
namespace NadekoBot;
|
||||
|
||||
public class SmartTextEmbedFooter
|
||||
{
|
||||
public string Text { get; set; }
|
||||
@@ -9,4 +9,3 @@ namespace NadekoBot
|
||||
[JsonProperty("icon_url")]
|
||||
private string Icon_Url { set => IconUrl = value; }
|
||||
}
|
||||
}
|
@@ -1,10 +1,9 @@
|
||||
using Discord;
|
||||
using Discord.WebSocket;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Common
|
||||
{
|
||||
namespace NadekoBot.Common;
|
||||
|
||||
public sealed class ReactionEventWrapper : IDisposable
|
||||
{
|
||||
public IUserMessage Message { get; }
|
||||
@@ -88,4 +87,3 @@ namespace NadekoBot.Common
|
||||
UnsubAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
namespace NadekoBot.Common.TypeReaders
|
||||
{
|
||||
namespace NadekoBot.Common.TypeReaders;
|
||||
|
||||
public enum AddRemove
|
||||
{
|
||||
Add = int.MinValue,
|
||||
Rem = int.MinValue + 1,
|
||||
Rm = int.MinValue + 1,
|
||||
}
|
||||
}
|
||||
|
@@ -1,12 +1,10 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Services;
|
||||
using NadekoBot.Modules.CustomReactions.Services;
|
||||
|
||||
namespace NadekoBot.Common.TypeReaders
|
||||
{
|
||||
namespace NadekoBot.Common.TypeReaders;
|
||||
|
||||
public sealed class CommandTypeReader : NadekoTypeReader<CommandInfo>
|
||||
{
|
||||
private readonly CommandHandler _handler;
|
||||
@@ -87,4 +85,3 @@ namespace NadekoBot.Common.TypeReaders
|
||||
this.CmdType = type;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,8 +2,8 @@
|
||||
using Discord;
|
||||
using Discord.Commands;
|
||||
|
||||
namespace NadekoBot.Common.TypeReaders
|
||||
{
|
||||
namespace NadekoBot.Common.TypeReaders;
|
||||
|
||||
public sealed class EmoteTypeReader : NadekoTypeReader<Emote>
|
||||
{
|
||||
public override Task<TypeReaderResult> ReadAsync(ICommandContext ctx, string input)
|
||||
@@ -14,4 +14,3 @@ namespace NadekoBot.Common.TypeReaders
|
||||
return Task.FromResult(TypeReaderResult.FromSuccess(emote));
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,10 +1,9 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Modules.Administration.Services;
|
||||
|
||||
namespace NadekoBot.Common.TypeReaders
|
||||
{
|
||||
namespace NadekoBot.Common.TypeReaders;
|
||||
|
||||
public sealed class GuildDateTimeTypeReader : NadekoTypeReader<GuildDateTime>
|
||||
{
|
||||
private readonly GuildTimezoneService _gts;
|
||||
@@ -50,4 +49,3 @@ namespace NadekoBot.Common.TypeReaders
|
||||
InputTimeUtc = TimeZoneInfo.ConvertTime(inputTime, Timezone, TimeZoneInfo.Utc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,11 +1,10 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using Discord.WebSocket;
|
||||
using Discord;
|
||||
|
||||
namespace NadekoBot.Common.TypeReaders
|
||||
{
|
||||
namespace NadekoBot.Common.TypeReaders;
|
||||
|
||||
public sealed class GuildTypeReader : NadekoTypeReader<IGuild>
|
||||
{
|
||||
private readonly DiscordSocketClient _client;
|
||||
@@ -28,4 +27,3 @@ namespace NadekoBot.Common.TypeReaders
|
||||
return Task.FromResult(TypeReaderResult.FromError(CommandError.ParseFailed, "No guild by that name or Id found"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,8 +1,8 @@
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
|
||||
namespace NadekoBot.Common.TypeReaders
|
||||
{
|
||||
namespace NadekoBot.Common.TypeReaders;
|
||||
|
||||
public sealed class KwumTypeReader : NadekoTypeReader<kwum>
|
||||
{
|
||||
public override Task<TypeReaderResult> ReadAsync(ICommandContext context, string input)
|
||||
@@ -21,4 +21,3 @@ namespace NadekoBot.Common.TypeReaders
|
||||
return Task.FromResult(TypeReaderResult.FromSuccess(SmartText.CreateFrom(input)));
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
namespace NadekoBot.Common.TypeReaders.Models
|
||||
{
|
||||
namespace NadekoBot.Common.TypeReaders.Models;
|
||||
|
||||
public class PermissionAction
|
||||
{
|
||||
public static PermissionAction Enable => new PermissionAction(true);
|
||||
@@ -24,4 +24,3 @@
|
||||
|
||||
public override int GetHashCode() => Value.GetHashCode();
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace NadekoBot.Common.TypeReaders.Models;
|
||||
|
||||
namespace NadekoBot.Common.TypeReaders.Models
|
||||
{
|
||||
public class StoopidTime
|
||||
{
|
||||
public string Input { get; set; }
|
||||
@@ -62,4 +60,3 @@ namespace NadekoBot.Common.TypeReaders.Models
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,9 @@
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Extensions;
|
||||
|
||||
namespace NadekoBot.Common.TypeReaders
|
||||
{
|
||||
namespace NadekoBot.Common.TypeReaders;
|
||||
|
||||
public sealed class ModuleTypeReader : NadekoTypeReader<ModuleInfo>
|
||||
{
|
||||
private readonly CommandService _cmds;
|
||||
@@ -52,4 +51,3 @@ namespace NadekoBot.Common.TypeReaders
|
||||
{
|
||||
public string Name { get; set; }
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
|
||||
namespace NadekoBot.Common.TypeReaders
|
||||
{
|
||||
namespace NadekoBot.Common.TypeReaders;
|
||||
|
||||
public abstract class NadekoTypeReader<T> : TypeReader
|
||||
{
|
||||
public abstract Task<TypeReaderResult> ReadAsync(ICommandContext ctx, string input);
|
||||
@@ -11,4 +10,3 @@ namespace NadekoBot.Common.TypeReaders
|
||||
public override Task<TypeReaderResult> ReadAsync(ICommandContext ctx, string input, IServiceProvider services)
|
||||
=> ReadAsync(ctx, input);
|
||||
}
|
||||
}
|
||||
|
@@ -2,8 +2,8 @@
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Common.TypeReaders.Models;
|
||||
|
||||
namespace NadekoBot.Common.TypeReaders
|
||||
{
|
||||
namespace NadekoBot.Common.TypeReaders;
|
||||
|
||||
/// <summary>
|
||||
/// Used instead of bool for more flexible keywords for true/false only in the permission module
|
||||
/// </summary>
|
||||
@@ -37,4 +37,3 @@ namespace NadekoBot.Common.TypeReaders
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,9 @@
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
using System.Threading.Tasks;
|
||||
using Discord.Commands;
|
||||
using SixLabors.ImageSharp;
|
||||
|
||||
namespace NadekoBot.Common.TypeReaders
|
||||
{
|
||||
namespace NadekoBot.Common.TypeReaders;
|
||||
|
||||
public sealed class Rgba32TypeReader : NadekoTypeReader<Color>
|
||||
{
|
||||
public override async Task<TypeReaderResult> ReadAsync(ICommandContext context, string input)
|
||||
@@ -22,4 +21,3 @@ namespace NadekoBot.Common.TypeReaders
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,13 +1,12 @@
|
||||
using Discord.Commands;
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using NadekoBot.Db;
|
||||
using NadekoBot.Modules.Gambling.Services;
|
||||
using NadekoBot.Services;
|
||||
|
||||
namespace NadekoBot.Common.TypeReaders
|
||||
{
|
||||
namespace NadekoBot.Common.TypeReaders;
|
||||
|
||||
public sealed class ShmartNumberTypeReader : NadekoTypeReader<ShmartNumber>
|
||||
{
|
||||
private readonly DbService _db;
|
||||
@@ -104,4 +103,3 @@ namespace NadekoBot.Common.TypeReaders
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,10 +1,9 @@
|
||||
using Discord.Commands;
|
||||
using NadekoBot.Common.TypeReaders.Models;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace NadekoBot.Common.TypeReaders
|
||||
{
|
||||
namespace NadekoBot.Common.TypeReaders;
|
||||
|
||||
public sealed class StoopidTimeTypeReader : NadekoTypeReader<StoopidTime>
|
||||
{
|
||||
public override Task<TypeReaderResult> ReadAsync(ICommandContext context, string input)
|
||||
@@ -22,4 +21,3 @@ namespace NadekoBot.Common.TypeReaders
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,7 +1,5 @@
|
||||
using System;
|
||||
namespace NadekoBot.Common.Yml;
|
||||
|
||||
namespace NadekoBot.Common.Yml
|
||||
{
|
||||
public class CommentAttribute : Attribute
|
||||
{
|
||||
public string Comment { get; }
|
||||
@@ -11,4 +9,3 @@ namespace NadekoBot.Common.Yml
|
||||
Comment = comment;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using YamlDotNet.Core;
|
||||
using YamlDotNet.Core;
|
||||
using YamlDotNet.Serialization;
|
||||
using YamlDotNet.Serialization.TypeInspectors;
|
||||
|
||||
namespace NadekoBot.Common.Yml
|
||||
{
|
||||
namespace NadekoBot.Common.Yml;
|
||||
|
||||
public class CommentGatheringTypeInspector : TypeInspectorSkeleton
|
||||
{
|
||||
private readonly ITypeInspector innerTypeDescriptor;
|
||||
@@ -70,4 +67,3 @@ namespace NadekoBot.Common.Yml
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,9 +1,8 @@
|
||||
using System;
|
||||
using YamlDotNet.Core;
|
||||
using YamlDotNet.Core;
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace NadekoBot.Common.Yml
|
||||
{
|
||||
namespace NadekoBot.Common.Yml;
|
||||
|
||||
public sealed class CommentsObjectDescriptor : IObjectDescriptor
|
||||
{
|
||||
private readonly IObjectDescriptor innerDescriptor;
|
||||
@@ -21,4 +20,3 @@ namespace NadekoBot.Common.Yml
|
||||
public Type StaticType { get { return innerDescriptor.StaticType; } }
|
||||
public ScalarStyle ScalarStyle { get { return innerDescriptor.ScalarStyle; } }
|
||||
}
|
||||
}
|
||||
|
@@ -3,8 +3,8 @@ using YamlDotNet.Core.Events;
|
||||
using YamlDotNet.Serialization;
|
||||
using YamlDotNet.Serialization.ObjectGraphVisitors;
|
||||
|
||||
namespace NadekoBot.Common.Yml
|
||||
{
|
||||
namespace NadekoBot.Common.Yml;
|
||||
|
||||
public class CommentsObjectGraphVisitor : ChainedObjectGraphVisitor
|
||||
{
|
||||
public CommentsObjectGraphVisitor(IObjectGraphVisitor<IEmitter> nextVisitor)
|
||||
@@ -23,4 +23,3 @@ namespace NadekoBot.Common.Yml
|
||||
return base.EnterMapping(key, value, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -2,8 +2,8 @@
|
||||
using YamlDotNet.Serialization;
|
||||
using YamlDotNet.Serialization.EventEmitters;
|
||||
|
||||
namespace NadekoBot.Common.Yml
|
||||
{
|
||||
namespace NadekoBot.Common.Yml;
|
||||
|
||||
public class MultilineScalarFlowStyleEmitter : ChainedEventEmitter
|
||||
{
|
||||
public MultilineScalarFlowStyleEmitter(IEventEmitter nextEmitter)
|
||||
@@ -29,4 +29,3 @@ namespace NadekoBot.Common.Yml
|
||||
nextEmitter.Emit(eventInfo, emitter);
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,12 +1,11 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Globalization;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using YamlDotNet.Core;
|
||||
using YamlDotNet.Core.Events;
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace NadekoBot.Common.Yml
|
||||
{
|
||||
namespace NadekoBot.Common.Yml;
|
||||
|
||||
public class Rgba32Converter : IYamlTypeConverter
|
||||
{
|
||||
public bool Accepts(Type type)
|
||||
@@ -49,4 +48,3 @@ namespace NadekoBot.Common.Yml
|
||||
emitter.Emit(new Scalar(ci.Name));
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,10 +1,9 @@
|
||||
using System;
|
||||
using YamlDotNet.Core;
|
||||
using YamlDotNet.Core;
|
||||
using YamlDotNet.Core.Events;
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace NadekoBot.Common.Yml
|
||||
{
|
||||
namespace NadekoBot.Common.Yml;
|
||||
|
||||
public class UriConverter : IYamlTypeConverter
|
||||
{
|
||||
public bool Accepts(Type type)
|
||||
@@ -25,4 +24,3 @@ namespace NadekoBot.Common.Yml
|
||||
emitter.Emit(new Scalar(uri.ToString()));
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
using YamlDotNet.Serialization;
|
||||
|
||||
namespace NadekoBot.Common.Yml
|
||||
{
|
||||
namespace NadekoBot.Common.Yml;
|
||||
|
||||
public class Yaml
|
||||
{
|
||||
public static ISerializer Serializer => new SerializerBuilder()
|
||||
@@ -23,4 +23,3 @@ namespace NadekoBot.Common.Yml
|
||||
.IgnoreUnmatchedProperties()
|
||||
.Build();
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
namespace NadekoBot.Common.Yml
|
||||
{
|
||||
namespace NadekoBot.Common.Yml;
|
||||
|
||||
public class YamlHelper
|
||||
{
|
||||
// https://github.com/aaubry/YamlDotNet/blob/0f4cc205e8b2dd8ef6589d96de32bf608a687c6f/YamlDotNet/Core/Scanner.cs#L1687
|
||||
@@ -55,4 +55,3 @@
|
||||
return c - 'a' + 10;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,10 +1,8 @@
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Db.Models;
|
||||
|
||||
namespace NadekoBot.Db
|
||||
{
|
||||
namespace NadekoBot.Db;
|
||||
|
||||
public static class ClubExtensions
|
||||
{
|
||||
private static IQueryable<ClubInfo> Include(this DbSet<ClubInfo> clubs)
|
||||
@@ -45,4 +43,3 @@ namespace NadekoBot.Db
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,10 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
|
||||
namespace NadekoBot.Db
|
||||
{
|
||||
namespace NadekoBot.Db;
|
||||
|
||||
public static class CurrencyTransactionExtensions
|
||||
{
|
||||
public static List<CurrencyTransaction> GetPageFor(this DbSet<CurrencyTransaction> set, ulong userId, int page)
|
||||
@@ -18,4 +16,3 @@ namespace NadekoBot.Db
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +1,9 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using LinqToDB;
|
||||
using NadekoBot.Services.Database.Models;
|
||||
|
||||
namespace NadekoBot.Db
|
||||
{
|
||||
namespace NadekoBot.Db;
|
||||
|
||||
public static class CustomReactionsExtensions
|
||||
{
|
||||
public static int ClearFromGuild(this DbSet<CustomReaction> crs, ulong guildId)
|
||||
@@ -27,4 +25,3 @@ namespace NadekoBot.Db
|
||||
return crs.FirstOrDefault(x => x.GuildId == guildId && x.Trigger.ToUpper() == input);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user