mirror of
https://github.com/RPCS3/discord-bot.git
synced 2026-01-31 01:25:22 +01:00
use file-scoped namespaces to reduce nesting
some formatting might be fucked
This commit is contained in:
@@ -12,10 +12,10 @@ using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using StrawberryShake;
|
||||
|
||||
namespace CirrusCiClient
|
||||
namespace CirrusCiClient;
|
||||
|
||||
public static class CirrusCi
|
||||
{
|
||||
public static class CirrusCi
|
||||
{
|
||||
private static readonly MemoryCache BuildInfoCache = new(new MemoryCacheOptions { ExpirationScanFrequency = TimeSpan.FromHours(1) });
|
||||
private static readonly IServiceProvider ServiceProvider;
|
||||
private static IClient Client => ServiceProvider.GetRequiredService<IClient>();
|
||||
@@ -148,5 +148,4 @@ namespace CirrusCiClient
|
||||
[return: NotNullIfNotNull(nameof(DateTime))]
|
||||
private static string? ToTimestamp(this DateTime? dateTime) => dateTime.HasValue ? (dateTime.Value.ToUniversalTime() - DateTime.UnixEpoch).TotalMilliseconds.ToString("0") : null;
|
||||
private static DateTime FromTimestamp(long timestamp) => DateTime.UnixEpoch.AddMilliseconds(timestamp);
|
||||
}
|
||||
}
|
||||
@@ -1,21 +1,20 @@
|
||||
using System;
|
||||
using CirrusCiClient.Generated;
|
||||
|
||||
namespace CirrusCiClient.POCOs
|
||||
namespace CirrusCiClient.POCOs;
|
||||
|
||||
public record BuildOSInfo
|
||||
{
|
||||
public record BuildOSInfo
|
||||
{
|
||||
public string? Filename { get; init; }
|
||||
public string? DownloadLink { get; init; }
|
||||
public TaskStatus? Status { get; init; }
|
||||
}
|
||||
public record BuildInfo
|
||||
{
|
||||
}
|
||||
public record BuildInfo
|
||||
{
|
||||
public string? Commit { get; init; }
|
||||
public DateTime StartTime { get; init; }
|
||||
public DateTime? FinishTime { get; init; }
|
||||
public BuildOSInfo? WindowsBuild { get; init; }
|
||||
public BuildOSInfo? LinuxBuild { get; init; }
|
||||
public BuildOSInfo? MacBuild { get; init; }
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace CirrusCiClient.POCOs
|
||||
namespace CirrusCiClient.POCOs;
|
||||
|
||||
public record ProjectBuildStats
|
||||
{
|
||||
public record ProjectBuildStats
|
||||
{
|
||||
public TimeSpan Percentile95 { get; init; }
|
||||
public TimeSpan Percentile90 { get; init; }
|
||||
public TimeSpan Percentile85 { get; init; }
|
||||
@@ -21,5 +21,4 @@ namespace CirrusCiClient.POCOs
|
||||
Mean = TimeSpan.FromSeconds(860),
|
||||
StdDev = TimeSpan.FromSeconds(420),
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -5,12 +5,12 @@ using System.Net.Http.Headers;
|
||||
using Microsoft.IO;
|
||||
using NLog;
|
||||
|
||||
namespace CompatApiClient
|
||||
{
|
||||
using ReturnCodeType = Dictionary<int, (bool displayResults, bool overrideAll, bool displayFooter, string info)>;
|
||||
namespace CompatApiClient;
|
||||
|
||||
public static class ApiConfig
|
||||
{
|
||||
using ReturnCodeType = Dictionary<int, (bool displayResults, bool overrideAll, bool displayFooter, string info)>;
|
||||
|
||||
public static class ApiConfig
|
||||
{
|
||||
public static readonly string ProductName = "RPCS3CompatibilityBot";
|
||||
public static readonly string ProductVersion = "2.0";
|
||||
public static readonly ProductInfoHeaderValue ProductInfoHeader = new(ProductName, ProductVersion);
|
||||
@@ -94,5 +94,4 @@ namespace CompatApiClient
|
||||
ReverseReleaseTypes = new Dictionary<string, char>();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,10 @@ using CompatApiClient.POCOs;
|
||||
using CompatApiClient.Utils;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace CompatApiClient
|
||||
namespace CompatApiClient;
|
||||
|
||||
public class Client: IDisposable
|
||||
{
|
||||
public class Client: IDisposable
|
||||
{
|
||||
private readonly HttpClient client;
|
||||
private readonly JsonSerializerOptions jsonOptions;
|
||||
private static readonly MemoryCache ResponseCache = new(new MemoryCacheOptions { ExpirationScanFrequency = TimeSpan.FromHours(1) });
|
||||
@@ -137,5 +137,4 @@ namespace CompatApiClient
|
||||
GC.SuppressFinalize(this);
|
||||
client.Dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,10 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CompatApiClient.Compression
|
||||
namespace CompatApiClient.Compression;
|
||||
|
||||
public class CompressedContent : HttpContent
|
||||
{
|
||||
public class CompressedContent : HttpContent
|
||||
{
|
||||
private readonly HttpContent content;
|
||||
private readonly ICompressor compressor;
|
||||
|
||||
@@ -38,5 +38,4 @@ namespace CompatApiClient.Compression
|
||||
Headers.ContentEncoding.Add(compressor.EncodingType);
|
||||
Headers.ContentLength = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,10 @@ using System.Net.Http;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CompatApiClient.Compression
|
||||
namespace CompatApiClient.Compression;
|
||||
|
||||
public class CompressionMessageHandler : DelegatingHandler
|
||||
{
|
||||
public class CompressionMessageHandler : DelegatingHandler
|
||||
{
|
||||
public ICollection<ICompressor> Compressors { get; }
|
||||
public static readonly string PostCompressionFlag = "X-Set-Content-Encoding";
|
||||
public static readonly string[] DefaultContentEncodings = { "gzip", "deflate" };
|
||||
@@ -64,5 +64,4 @@ namespace CompatApiClient.Compression
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CompatApiClient.Compression
|
||||
namespace CompatApiClient.Compression;
|
||||
|
||||
public abstract class Compressor : ICompressor
|
||||
{
|
||||
public abstract class Compressor : ICompressor
|
||||
{
|
||||
public abstract string EncodingType { get; }
|
||||
protected abstract Stream CreateCompressionStream(Stream output);
|
||||
protected abstract Stream CreateDecompressionStream(Stream input);
|
||||
@@ -28,5 +28,4 @@ namespace CompatApiClient.Compression
|
||||
await memStream.CopyToAsync(destination).ConfigureAwait(false);
|
||||
return memStream.Length;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,10 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CompatApiClient.Compression
|
||||
namespace CompatApiClient.Compression;
|
||||
|
||||
public class DecompressedContent : HttpContent
|
||||
{
|
||||
public class DecompressedContent : HttpContent
|
||||
{
|
||||
private readonly HttpContent content;
|
||||
private readonly ICompressor compressor;
|
||||
|
||||
@@ -38,5 +38,4 @@ namespace CompatApiClient.Compression
|
||||
Headers.ContentEncoding.Clear();
|
||||
Headers.ContentLength = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
|
||||
namespace CompatApiClient.Compression
|
||||
namespace CompatApiClient.Compression;
|
||||
|
||||
public class DeflateCompressor : Compressor
|
||||
{
|
||||
public class DeflateCompressor : Compressor
|
||||
{
|
||||
public override string EncodingType => "deflate";
|
||||
|
||||
protected override Stream CreateCompressionStream(Stream output)
|
||||
@@ -12,5 +12,4 @@ namespace CompatApiClient.Compression
|
||||
|
||||
protected override Stream CreateDecompressionStream(Stream input)
|
||||
=> new DeflateStream(input, CompressionMode.Decompress, true);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
|
||||
namespace CompatApiClient.Compression
|
||||
namespace CompatApiClient.Compression;
|
||||
|
||||
public class GZipCompressor : Compressor
|
||||
{
|
||||
public class GZipCompressor : Compressor
|
||||
{
|
||||
public override string EncodingType => "gzip";
|
||||
|
||||
protected override Stream CreateCompressionStream(Stream output)
|
||||
@@ -12,5 +12,4 @@ namespace CompatApiClient.Compression
|
||||
|
||||
protected override Stream CreateDecompressionStream(Stream input)
|
||||
=> new GZipStream(input, CompressionMode.Decompress, true);
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,11 @@
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CompatApiClient.Compression
|
||||
namespace CompatApiClient.Compression;
|
||||
|
||||
public interface ICompressor
|
||||
{
|
||||
public interface ICompressor
|
||||
{
|
||||
string EncodingType { get; }
|
||||
Task<long> CompressAsync(Stream source, Stream destination);
|
||||
Task<long> DecompressAsync(Stream source, Stream destination);
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CompatApiClient
|
||||
namespace CompatApiClient;
|
||||
|
||||
public sealed class CompatApiCommitHashConverter : JsonConverter<string>
|
||||
{
|
||||
public sealed class CompatApiCommitHashConverter : JsonConverter<string>
|
||||
{
|
||||
public override string? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
|
||||
{
|
||||
if (reader.TokenType == JsonTokenType.Number
|
||||
@@ -22,5 +22,4 @@ namespace CompatApiClient
|
||||
|
||||
public override void Write(Utf8JsonWriter writer, string value, JsonSerializerOptions options)
|
||||
=> writer.WriteStringValue(value);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace CompatApiClient
|
||||
namespace CompatApiClient;
|
||||
|
||||
public sealed class DashedNamingPolicy: JsonNamingPolicy
|
||||
{
|
||||
public sealed class DashedNamingPolicy: JsonNamingPolicy
|
||||
{
|
||||
public override string ConvertName(string name) => NamingStyles.Dashed(name);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace CompatApiClient
|
||||
namespace CompatApiClient;
|
||||
|
||||
public static class NamingStyles
|
||||
{
|
||||
public static class NamingStyles
|
||||
{
|
||||
public static string CamelCase(string value)
|
||||
{
|
||||
if (value == null)
|
||||
@@ -54,5 +54,4 @@ namespace CompatApiClient
|
||||
}
|
||||
return builder.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
using System.Text.Json;
|
||||
|
||||
namespace CompatApiClient
|
||||
namespace CompatApiClient;
|
||||
|
||||
public sealed class SnakeCaseNamingPolicy: JsonNamingPolicy
|
||||
{
|
||||
public sealed class SnakeCaseNamingPolicy: JsonNamingPolicy
|
||||
{
|
||||
public override string ConvertName(string name) => NamingStyles.Underscore(name);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,7 @@
|
||||
namespace CompatApiClient.Formatters
|
||||
namespace CompatApiClient.Formatters;
|
||||
|
||||
public static class SpecialJsonNamingPolicy
|
||||
{
|
||||
public static class SpecialJsonNamingPolicy
|
||||
{
|
||||
public static SnakeCaseNamingPolicy SnakeCase { get; } = new();
|
||||
public static DashedNamingPolicy Dashed { get; } = new();
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,11 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace CompatApiClient.POCOs
|
||||
{
|
||||
#nullable disable
|
||||
namespace CompatApiClient.POCOs;
|
||||
#nullable disable
|
||||
|
||||
public class CompatResult
|
||||
{
|
||||
public class CompatResult
|
||||
{
|
||||
public int ReturnCode;
|
||||
public string SearchTerm;
|
||||
public Dictionary<string, TitleInfo> Results;
|
||||
@@ -16,10 +15,10 @@ namespace CompatApiClient.POCOs
|
||||
public TimeSpan RequestDuration;
|
||||
[JsonIgnore]
|
||||
public RequestBuilder RequestBuilder;
|
||||
}
|
||||
}
|
||||
|
||||
public class TitleInfo
|
||||
{
|
||||
public class TitleInfo
|
||||
{
|
||||
public static readonly TitleInfo Maintenance = new() { Status = "Maintenance" };
|
||||
public static readonly TitleInfo CommunicationError = new() { Status = "Error" };
|
||||
public static readonly TitleInfo Unknown = new() { Status = "Unknown" };
|
||||
@@ -37,7 +36,6 @@ namespace CompatApiClient.POCOs
|
||||
public int? Network;
|
||||
public string Update;
|
||||
public bool? UsingLocalCache;
|
||||
}
|
||||
|
||||
#nullable restore
|
||||
}
|
||||
|
||||
#nullable restore
|
||||
@@ -1,27 +1,25 @@
|
||||
namespace CompatApiClient.POCOs
|
||||
{
|
||||
#nullable disable
|
||||
namespace CompatApiClient.POCOs;
|
||||
#nullable disable
|
||||
|
||||
public class UpdateInfo
|
||||
{
|
||||
public class UpdateInfo
|
||||
{
|
||||
public int ReturnCode;
|
||||
public BuildInfo LatestBuild;
|
||||
public BuildInfo CurrentBuild;
|
||||
}
|
||||
}
|
||||
|
||||
public class BuildInfo
|
||||
{
|
||||
public class BuildInfo
|
||||
{
|
||||
public int? Pr;
|
||||
public string Datetime;
|
||||
public BuildLink Windows;
|
||||
public BuildLink Linux;
|
||||
public BuildLink Mac;
|
||||
}
|
||||
|
||||
public class BuildLink
|
||||
{
|
||||
public string Download;
|
||||
}
|
||||
|
||||
#nullable restore
|
||||
}
|
||||
|
||||
public class BuildLink
|
||||
{
|
||||
public string Download;
|
||||
}
|
||||
|
||||
#nullable restore
|
||||
@@ -2,10 +2,10 @@
|
||||
using System.Collections.Generic;
|
||||
using CompatApiClient.Utils;
|
||||
|
||||
namespace CompatApiClient
|
||||
namespace CompatApiClient;
|
||||
|
||||
public class RequestBuilder
|
||||
{
|
||||
public class RequestBuilder
|
||||
{
|
||||
public string? Search { get; private set; } = "";
|
||||
public int AmountRequested { get; } = ApiConfig.ResultAmount[0];
|
||||
|
||||
@@ -30,5 +30,4 @@ namespace CompatApiClient
|
||||
parameters["api"] = "v" + ApiConfig.Version;
|
||||
return ApiConfig.BaseUrl.SetQueryParameters(parameters);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Net.Http;
|
||||
|
||||
namespace CompatApiClient.Utils
|
||||
namespace CompatApiClient.Utils;
|
||||
|
||||
public static class ConsoleLogger
|
||||
{
|
||||
public static class ConsoleLogger
|
||||
{
|
||||
public static void PrintError(Exception e, HttpResponseMessage? response, bool isError = true)
|
||||
{
|
||||
if (isError)
|
||||
@@ -22,5 +22,4 @@ namespace CompatApiClient.Utils
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace CompatApiClient.Utils
|
||||
namespace CompatApiClient.Utils;
|
||||
|
||||
public static class Statistics
|
||||
{
|
||||
public static class Statistics
|
||||
{
|
||||
public static long Mean(this IEnumerable<long> data)
|
||||
{
|
||||
System.Numerics.BigInteger sum = 0;
|
||||
@@ -36,5 +36,4 @@ namespace CompatApiClient.Utils
|
||||
var σ2 = σx * σx;
|
||||
return Math.Sqrt((double)((n * σx2) - σ2) / ((n - 1) * n));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,10 @@ using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
|
||||
namespace CompatApiClient.Utils
|
||||
namespace CompatApiClient.Utils;
|
||||
|
||||
public static class UriExtensions
|
||||
{
|
||||
public static class UriExtensions
|
||||
{
|
||||
private static readonly Uri FakeHost = new("sc://q"); // s:// will be parsed as file:///s:// for some reason
|
||||
|
||||
public static NameValueCollection ParseQueryString(Uri uri)
|
||||
@@ -117,5 +117,4 @@ namespace CompatApiClient.Utils
|
||||
return new Uri(newUri, UriKind.Relative);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
using System;
|
||||
|
||||
namespace CompatApiClient.Utils
|
||||
namespace CompatApiClient.Utils;
|
||||
|
||||
public static class Utils
|
||||
{
|
||||
public static class Utils
|
||||
{
|
||||
private const long UnderKB = 1000;
|
||||
private const long UnderMB = 1000 * 1024;
|
||||
private const long UnderGB = 1000 * 1024 * 1024;
|
||||
@@ -56,5 +56,4 @@ namespace CompatApiClient.Utils
|
||||
return $"{bytes / 1024.0 / 1024:0.##} MB";
|
||||
return $"{bytes / 1024.0 / 1024 / 1024:0.##} GB";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,10 @@ using System.Threading.Tasks;
|
||||
using CompatApiClient;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace GithubClient
|
||||
namespace GithubClient;
|
||||
|
||||
public class Client
|
||||
{
|
||||
public class Client
|
||||
{
|
||||
private readonly Octokit.GitHubClient client;
|
||||
|
||||
private static readonly TimeSpan PrStatusCacheTime = TimeSpan.FromMinutes(3);
|
||||
@@ -148,6 +148,4 @@ namespace GithubClient
|
||||
ApiConfig.Log.Warn($"Github rate limit is low: {RateLimitRemaining} out of {RateLimit}, will be reset on {RateLimitResetTime:u}");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,10 +16,10 @@ using HtmlAgilityPack;
|
||||
using IrdLibraryClient.IrdFormat;
|
||||
using IrdLibraryClient.POCOs;
|
||||
|
||||
namespace IrdLibraryClient
|
||||
namespace IrdLibraryClient;
|
||||
|
||||
public class IrdClient
|
||||
{
|
||||
public class IrdClient
|
||||
{
|
||||
public static readonly string BaseUrl = "https://ps3.aldostools.org";
|
||||
|
||||
private readonly HttpClient client;
|
||||
@@ -214,5 +214,4 @@ namespace IrdLibraryClient
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace IrdLibraryClient.IrdFormat
|
||||
namespace IrdLibraryClient.IrdFormat;
|
||||
|
||||
public sealed class Ird
|
||||
{
|
||||
public sealed class Ird
|
||||
{
|
||||
internal Ird(){}
|
||||
|
||||
public static readonly int Magic = BitConverter.ToInt32(Encoding.ASCII.GetBytes("3IRD"), 0);
|
||||
@@ -32,13 +32,12 @@ namespace IrdLibraryClient.IrdFormat
|
||||
// Pic for <v9
|
||||
public int Uid;
|
||||
public uint Crc32;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class IrdFile
|
||||
{
|
||||
public sealed class IrdFile
|
||||
{
|
||||
internal IrdFile() {}
|
||||
|
||||
public long Offset;
|
||||
public byte[] Md5Checksum = null!;
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,10 @@ using System.Text;
|
||||
using CompatApiClient;
|
||||
using Force.Crc32;
|
||||
|
||||
namespace IrdLibraryClient.IrdFormat
|
||||
namespace IrdLibraryClient.IrdFormat;
|
||||
|
||||
public static class IrdParser
|
||||
{
|
||||
public static class IrdParser
|
||||
{
|
||||
public static Ird Parse(byte[] content)
|
||||
{
|
||||
if (content == null)
|
||||
@@ -75,5 +75,4 @@ namespace IrdLibraryClient.IrdFormat
|
||||
throw new InvalidDataException($"Corrupted IRD data, expected {result.Crc32:x8}, but was {crc32:x8}");
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,10 +5,10 @@ using System.Linq;
|
||||
using CompatApiClient;
|
||||
using DiscUtils.Iso9660;
|
||||
|
||||
namespace IrdLibraryClient.IrdFormat
|
||||
namespace IrdLibraryClient.IrdFormat;
|
||||
|
||||
public static class IsoHeaderParser
|
||||
{
|
||||
public static class IsoHeaderParser
|
||||
{
|
||||
public static List<string> GetFilenames(this Ird ird)
|
||||
{
|
||||
using var decompressedStream = ApiConfig.MemoryStreamManager.GetStream();
|
||||
@@ -28,5 +28,4 @@ namespace IrdLibraryClient.IrdFormat
|
||||
.TrimEnd('.')
|
||||
).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace IrdLibraryClient.POCOs
|
||||
{
|
||||
public sealed class SearchResult
|
||||
{
|
||||
public List<SearchResultItem>? Data;
|
||||
}
|
||||
namespace IrdLibraryClient.POCOs;
|
||||
|
||||
public sealed class SearchResultItem
|
||||
{
|
||||
public sealed class SearchResult
|
||||
{
|
||||
public List<SearchResultItem>? Data;
|
||||
}
|
||||
|
||||
public sealed class SearchResultItem
|
||||
{
|
||||
public string? Id; // product code
|
||||
public string? Title;
|
||||
public string? GameVersion;
|
||||
@@ -21,5 +21,4 @@ namespace IrdLibraryClient.POCOs
|
||||
public string? IrdName;
|
||||
|
||||
public string? Filename;
|
||||
}
|
||||
}
|
||||
@@ -15,10 +15,10 @@ using System.Text.RegularExpressions;
|
||||
using CompatApiClient.Formatters;
|
||||
using MediafireClient.POCOs;
|
||||
|
||||
namespace MediafireClient
|
||||
namespace MediafireClient;
|
||||
|
||||
public sealed class Client
|
||||
{
|
||||
public sealed class Client
|
||||
{
|
||||
private readonly HttpClient client;
|
||||
private readonly JsonSerializerOptions jsonOptions;
|
||||
|
||||
@@ -96,5 +96,4 @@ namespace MediafireClient
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,26 +1,24 @@
|
||||
namespace MediafireClient.POCOs
|
||||
namespace MediafireClient.POCOs;
|
||||
#nullable disable
|
||||
|
||||
public sealed class LinksResult
|
||||
{
|
||||
#nullable disable
|
||||
|
||||
public sealed class LinksResult
|
||||
{
|
||||
public LinksResponse Response;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class LinksResponse
|
||||
{
|
||||
public sealed class LinksResponse
|
||||
{
|
||||
public string Action;
|
||||
public string Result;
|
||||
public string CurrentApiVersion;
|
||||
public Link[] Links;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class Link
|
||||
{
|
||||
public sealed class Link
|
||||
{
|
||||
public string Quickkey;
|
||||
public string NormalDownload;
|
||||
public string DirectDownload;
|
||||
}
|
||||
|
||||
#nullable restore
|
||||
}
|
||||
|
||||
#nullable restore
|
||||
@@ -10,10 +10,10 @@ using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using OneDriveClient.POCOs;
|
||||
|
||||
namespace OneDriveClient
|
||||
namespace OneDriveClient;
|
||||
|
||||
public class Client
|
||||
{
|
||||
public class Client
|
||||
{
|
||||
private readonly HttpClient client;
|
||||
private readonly HttpClient noRedirectsClient;
|
||||
private readonly JsonSerializerOptions jsonOptions;
|
||||
@@ -104,5 +104,4 @@ namespace OneDriveClient
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace OneDriveClient.POCOs
|
||||
namespace OneDriveClient.POCOs;
|
||||
|
||||
public sealed class DriveItemMeta
|
||||
{
|
||||
public sealed class DriveItemMeta
|
||||
{
|
||||
public string? Id;
|
||||
public string? Name;
|
||||
public int Size;
|
||||
@@ -11,5 +11,4 @@ namespace OneDriveClient.POCOs
|
||||
public string? OdataContext;
|
||||
[JsonPropertyName("@content.downloadUrl")]
|
||||
public string? ContentDownloadUrl;
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,10 @@ using System.Reflection;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using CompatApiClient;
|
||||
|
||||
namespace PsnClient
|
||||
namespace PsnClient;
|
||||
|
||||
public class CustomTlsCertificatesHandler: HttpClientHandler
|
||||
{
|
||||
public class CustomTlsCertificatesHandler: HttpClientHandler
|
||||
{
|
||||
private readonly Func<HttpRequestMessage, X509Certificate2?, X509Chain?, SslPolicyErrors, bool>? defaultCertHandler;
|
||||
private static readonly X509CertificateCollection CustomCaCollection = new X509Certificate2Collection();
|
||||
private static readonly ConcurrentDictionary<string, bool> ValidationCache = new(1, 5);
|
||||
@@ -106,5 +106,4 @@ namespace PsnClient
|
||||
#endif
|
||||
return defaultCertHandler?.Invoke(requestMessage, certificate, chain, policyErrors) ?? true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +1,23 @@
|
||||
namespace PsnClient.POCOs
|
||||
{
|
||||
// https://transact.playstation.com/assets/app.json
|
||||
// returns an array of different objects
|
||||
// api endpoints, oauth, oauth authorize, telemetry, localization options, billing template, locales, country names, topup settings, paypal sandbox settings, gct, apm, sofort, ...
|
||||
namespace PsnClient.POCOs;
|
||||
// https://transact.playstation.com/assets/app.json
|
||||
// returns an array of different objects
|
||||
// api endpoints, oauth, oauth authorize, telemetry, localization options, billing template, locales, country names, topup settings, paypal sandbox settings, gct, apm, sofort, ...
|
||||
|
||||
// this is item #6 in App array
|
||||
public sealed class AppLocales
|
||||
{
|
||||
// this is item #6 in App array
|
||||
public sealed class AppLocales
|
||||
{
|
||||
public string[]? EnabledLocales; // "ar-AE",...
|
||||
public AppLocaleOverride[]? Overrides;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class AppLocaleOverride
|
||||
{
|
||||
public sealed class AppLocaleOverride
|
||||
{
|
||||
public AppLocaleOverrideCriteria? Criteria;
|
||||
public string? GensenLocale; // "ar-AE"
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class AppLocaleOverrideCriteria
|
||||
{
|
||||
public sealed class AppLocaleOverrideCriteria
|
||||
{
|
||||
public string? Language; // "ar"
|
||||
public string? Country; // "AE|BH|KW|LB|OM|QA|SA"
|
||||
}
|
||||
}
|
||||
@@ -1,24 +1,23 @@
|
||||
using System;
|
||||
|
||||
namespace PsnClient.POCOs
|
||||
{
|
||||
namespace PsnClient.POCOs;
|
||||
#nullable disable
|
||||
public sealed class Container
|
||||
{
|
||||
public sealed class Container
|
||||
{
|
||||
public ContainerData Data;
|
||||
public ContainerIncluded[] Included;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ContainerData
|
||||
{
|
||||
public sealed class ContainerData
|
||||
{
|
||||
public string Id;
|
||||
public string Type;
|
||||
public ContainerDataAttributes Attributes;
|
||||
public Relationships Relationships;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ContainerDataAttributes
|
||||
{
|
||||
public sealed class ContainerDataAttributes
|
||||
{
|
||||
public string Name;
|
||||
public bool? NsxPsPlusUpsell;
|
||||
public int? TemplateId;
|
||||
@@ -31,35 +30,35 @@ namespace PsnClient.POCOs
|
||||
public ContainerFacet[] Facets;
|
||||
public ContainerPromoBackground[] PromoBackgrounds;
|
||||
public ContainerDataAttributesSubScenes SubScenes;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ContainerFacet
|
||||
{
|
||||
public sealed class ContainerFacet
|
||||
{
|
||||
public string Name;
|
||||
public ContainerFacetItem[] Items;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ContainerFacetItem
|
||||
{
|
||||
public sealed class ContainerFacetItem
|
||||
{
|
||||
public string Key;
|
||||
public string Name;
|
||||
public int Count;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ContainerBanner { }
|
||||
public sealed class ContainerPromoBackground { }
|
||||
public sealed class ContainerDataAttributesSubScenes { }
|
||||
public sealed class ContainerBanner { }
|
||||
public sealed class ContainerPromoBackground { }
|
||||
public sealed class ContainerDataAttributesSubScenes { }
|
||||
|
||||
public sealed class ContainerIncluded
|
||||
{
|
||||
public sealed class ContainerIncluded
|
||||
{
|
||||
public string Id;
|
||||
public string Type;
|
||||
public ContainerIncludedAttributes Attributes;
|
||||
public Relationships Relationships;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class ContainerIncludedAttributes
|
||||
{
|
||||
public sealed class ContainerIncludedAttributes
|
||||
{
|
||||
public string ContentType; // "1"
|
||||
public string DefaultSkuId;
|
||||
public bool DobRequired;
|
||||
@@ -94,111 +93,110 @@ namespace PsnClient.POCOs
|
||||
// legacy-sku
|
||||
public GameSkuRelation[] Eligibilities;
|
||||
public GameSkuRelation[] Entitlements;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GameFileSize
|
||||
{
|
||||
public sealed class GameFileSize
|
||||
{
|
||||
public string Unit;
|
||||
public decimal? Value;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GameMediaList
|
||||
{
|
||||
public sealed class GameMediaList
|
||||
{
|
||||
public GameMediaPreview[] Preview;
|
||||
public GameMediaPromo Promo;
|
||||
public GameMediaLink[] Screenshots;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GameMediaPreview { }
|
||||
public sealed class GameMediaPreview { }
|
||||
|
||||
public sealed class GameMediaPromo
|
||||
{
|
||||
public sealed class GameMediaPromo
|
||||
{
|
||||
public GameMediaLink[] Images;
|
||||
public GameMediaLink[] Videos;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GameMediaLink
|
||||
{
|
||||
public sealed class GameMediaLink
|
||||
{
|
||||
public string Url;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GameParent
|
||||
{
|
||||
public sealed class GameParent
|
||||
{
|
||||
public string Id;
|
||||
public string Name;
|
||||
public string Thumbnail;
|
||||
public string Url;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GameSku
|
||||
{
|
||||
public sealed class GameSku
|
||||
{
|
||||
public string Id;
|
||||
public string Name;
|
||||
public bool IsPreorder;
|
||||
public bool? Multibuy;
|
||||
public DateTime? PlayabilityDate;
|
||||
public GameSkuPrices Prices;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GameSkuPrices
|
||||
{
|
||||
public sealed class GameSkuPrices
|
||||
{
|
||||
public GameSkuPricesInfo NonPlusUser;
|
||||
public GameSkuPricesInfo PlusUser;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GameSkuPricesInfo
|
||||
{
|
||||
public sealed class GameSkuPricesInfo
|
||||
{
|
||||
public GamePriceInfo ActualPrice;
|
||||
public GamePriceAvailability Availability;
|
||||
public decimal DiscountPercentage;
|
||||
public bool IsPlus;
|
||||
public GamePriceInfo StrikeThroughPrice;
|
||||
public GamePriceInfo UpsellPrice;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GamePriceInfo
|
||||
{
|
||||
public sealed class GamePriceInfo
|
||||
{
|
||||
public string Display;
|
||||
public decimal Value;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GamePriceAvailability
|
||||
{
|
||||
public sealed class GamePriceAvailability
|
||||
{
|
||||
public DateTime? StartDate;
|
||||
public DateTime? EndDate;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GameStarRating
|
||||
{
|
||||
public sealed class GameStarRating
|
||||
{
|
||||
public decimal Score;
|
||||
public int Total;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GameLanguageCode
|
||||
{
|
||||
public sealed class GameLanguageCode
|
||||
{
|
||||
public string Name;
|
||||
public string[] Codes;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GameUpsellInfo
|
||||
{
|
||||
public sealed class GameUpsellInfo
|
||||
{
|
||||
public string Type;
|
||||
public string DisplayPrice;
|
||||
public bool IsFree;
|
||||
public decimal DiscountPercentageDifference;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class GameSkuRelation
|
||||
{
|
||||
public sealed class GameSkuRelation
|
||||
{
|
||||
public string Id;
|
||||
public string Name;
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class FirmwareInfo
|
||||
{
|
||||
public sealed class FirmwareInfo
|
||||
{
|
||||
public string Version;
|
||||
public string DownloadUrl;
|
||||
public string Locale;
|
||||
}
|
||||
#nullable restore
|
||||
}
|
||||
#nullable restore
|
||||
@@ -1,26 +1,24 @@
|
||||
namespace PsnClient.POCOs
|
||||
namespace PsnClient.POCOs;
|
||||
#nullable disable
|
||||
public class Relationships
|
||||
{
|
||||
#nullable disable
|
||||
public class Relationships
|
||||
{
|
||||
public RelationshipsChildren Children;
|
||||
public RelationshipsLegacySkus LegacySkus;
|
||||
}
|
||||
}
|
||||
|
||||
public class RelationshipsChildren
|
||||
{
|
||||
public class RelationshipsChildren
|
||||
{
|
||||
public RelationshipsChildrenItem[] Data;
|
||||
}
|
||||
}
|
||||
|
||||
public class RelationshipsChildrenItem
|
||||
{
|
||||
public class RelationshipsChildrenItem
|
||||
{
|
||||
public string Id;
|
||||
public string Type;
|
||||
}
|
||||
|
||||
public class RelationshipsLegacySkus
|
||||
{
|
||||
public RelationshipsChildrenItem[] Data;
|
||||
}
|
||||
#nullable restore
|
||||
}
|
||||
|
||||
public class RelationshipsLegacySkus
|
||||
{
|
||||
public RelationshipsChildrenItem[] Data;
|
||||
}
|
||||
#nullable restore
|
||||
@@ -1,50 +1,48 @@
|
||||
namespace PsnClient.POCOs
|
||||
namespace PsnClient.POCOs;
|
||||
#nullable disable
|
||||
public class StoreNavigation
|
||||
{
|
||||
#nullable disable
|
||||
public class StoreNavigation
|
||||
{
|
||||
public StoreNavigationData Data;
|
||||
//public StoreNavigationIncluded Included;
|
||||
}
|
||||
}
|
||||
|
||||
public class StoreNavigationData
|
||||
{
|
||||
public class StoreNavigationData
|
||||
{
|
||||
public string Id;
|
||||
public string Type;
|
||||
public StoreNavigationAttributes Attributes;
|
||||
public Relationships Relationships;
|
||||
}
|
||||
}
|
||||
|
||||
public class StoreNavigationAttributes
|
||||
{
|
||||
public class StoreNavigationAttributes
|
||||
{
|
||||
public string Name;
|
||||
public StoreNavigationNavigation[] Navigation;
|
||||
}
|
||||
}
|
||||
|
||||
public class StoreNavigationNavigation
|
||||
{
|
||||
public class StoreNavigationNavigation
|
||||
{
|
||||
public string Id;
|
||||
public string Name;
|
||||
public string TargetContainerId;
|
||||
public string RouteName;
|
||||
public StoreNavigationSubmenu[] Submenu;
|
||||
}
|
||||
}
|
||||
|
||||
public class StoreNavigationSubmenu
|
||||
{
|
||||
public class StoreNavigationSubmenu
|
||||
{
|
||||
public string Name;
|
||||
public string TargetContainerId;
|
||||
public int? TemplateDefId;
|
||||
public StoreNavigationSubmenuItem[] Items;
|
||||
}
|
||||
}
|
||||
|
||||
public class StoreNavigationSubmenuItem
|
||||
{
|
||||
public class StoreNavigationSubmenuItem
|
||||
{
|
||||
public string Name;
|
||||
public string TargetContainerId;
|
||||
public string TargetContainerType;
|
||||
public int? TemplateDefId;
|
||||
public bool IsSeparator;
|
||||
}
|
||||
#nullable restore
|
||||
}
|
||||
#nullable restore
|
||||
@@ -1,32 +1,30 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace PsnClient.POCOs
|
||||
namespace PsnClient.POCOs;
|
||||
#nullable disable
|
||||
// https://store.playstation.com/kamaji/api/valkyrie_storefront/00_09_000/user/stores
|
||||
// requires session
|
||||
public class Stores
|
||||
{
|
||||
#nullable disable
|
||||
// https://store.playstation.com/kamaji/api/valkyrie_storefront/00_09_000/user/stores
|
||||
// requires session
|
||||
public class Stores
|
||||
{
|
||||
public StoresHeader Header;
|
||||
public StoresData Data;
|
||||
}
|
||||
}
|
||||
|
||||
public class StoresHeader
|
||||
{
|
||||
public class StoresHeader
|
||||
{
|
||||
public string Details;
|
||||
[JsonPropertyName("errorUUID")]
|
||||
public string ErrorUuid;
|
||||
|
||||
public string MessageKey; // "success"
|
||||
public string StatusCode; // "0x0000"
|
||||
}
|
||||
}
|
||||
|
||||
public class StoresData
|
||||
{
|
||||
public class StoresData
|
||||
{
|
||||
public string BaseUrl;
|
||||
public string RootUrl;
|
||||
public string SearchUrl;
|
||||
public string TumblerUrl;
|
||||
}
|
||||
#nullable restore
|
||||
}
|
||||
#nullable restore
|
||||
@@ -1,12 +1,11 @@
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace PsnClient.POCOs
|
||||
{
|
||||
#nullable disable
|
||||
namespace PsnClient.POCOs;
|
||||
#nullable disable
|
||||
|
||||
[XmlRoot("title-info")]
|
||||
public class TitleMeta
|
||||
{
|
||||
[XmlRoot("title-info")]
|
||||
public class TitleMeta
|
||||
{
|
||||
[XmlAttribute("rev")]
|
||||
public int Rev { get; set; }
|
||||
[XmlElement("id")]
|
||||
@@ -25,15 +24,14 @@ namespace PsnClient.POCOs
|
||||
public string Resolution { get; set; }
|
||||
[XmlElement("sound-format")]
|
||||
public string SoundFormat { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class TitleIcon
|
||||
{
|
||||
public class TitleIcon
|
||||
{
|
||||
[XmlAttribute("type")]
|
||||
public string Type { get; set; }
|
||||
[XmlText]
|
||||
public string Url { get; set; }
|
||||
}
|
||||
|
||||
#nullable restore
|
||||
}
|
||||
|
||||
#nullable restore
|
||||
@@ -1,13 +1,12 @@
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace PsnClient.POCOs
|
||||
{
|
||||
#nullable disable
|
||||
namespace PsnClient.POCOs;
|
||||
#nullable disable
|
||||
|
||||
[XmlRoot("titlepatch")]
|
||||
public class TitlePatch
|
||||
{
|
||||
[XmlRoot("titlepatch")]
|
||||
public class TitlePatch
|
||||
{
|
||||
[XmlAttribute("titleid")]
|
||||
public string TitleId { get; set; }
|
||||
[XmlAttribute("status")]
|
||||
@@ -16,19 +15,19 @@ namespace PsnClient.POCOs
|
||||
public TitlePatchTag Tag { get; set; }
|
||||
[XmlIgnore]
|
||||
public DateTime? OfflineCacheTimestamp { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class TitlePatchTag
|
||||
{
|
||||
public class TitlePatchTag
|
||||
{
|
||||
[XmlAttribute("name")]
|
||||
public string Name { get; set; }
|
||||
//no root element
|
||||
[XmlElement("package")]
|
||||
public TitlePatchPackage[] Packages { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class TitlePatchPackage
|
||||
{
|
||||
public class TitlePatchPackage
|
||||
{
|
||||
[XmlAttribute("version")]
|
||||
public string Version { get; set; }
|
||||
[XmlAttribute("size")]
|
||||
@@ -41,13 +40,12 @@ namespace PsnClient.POCOs
|
||||
public string Ps3SystemVer { get; set; }
|
||||
[XmlElement("paramsfo")]
|
||||
public TitlePatchParamSfo ParamSfo { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class TitlePatchParamSfo
|
||||
{
|
||||
public class TitlePatchParamSfo
|
||||
{
|
||||
[XmlElement("TITLE")]
|
||||
public string Title { get; set; }
|
||||
}
|
||||
|
||||
#nullable restore
|
||||
}
|
||||
|
||||
#nullable restore
|
||||
@@ -18,10 +18,10 @@ using Microsoft.Extensions.Caching.Memory;
|
||||
using PsnClient.POCOs;
|
||||
using PsnClient.Utils;
|
||||
|
||||
namespace PsnClient
|
||||
namespace PsnClient;
|
||||
|
||||
public class Client
|
||||
{
|
||||
public class Client
|
||||
{
|
||||
private readonly HttpClient client;
|
||||
private readonly JsonSerializerOptions dashedJson;
|
||||
private readonly JsonSerializerOptions snakeJson;
|
||||
@@ -444,5 +444,4 @@ namespace PsnClient
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace PsnClient.Utils
|
||||
namespace PsnClient.Utils;
|
||||
|
||||
public static class LocaleUtils
|
||||
{
|
||||
public static class LocaleUtils
|
||||
{
|
||||
public static (string language, string country) AsLocaleData(this string locale)
|
||||
{
|
||||
/*
|
||||
@@ -14,5 +14,4 @@
|
||||
var localeParts = locale.Split('-');
|
||||
return (localeParts[0], localeParts[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,10 @@ using System.Globalization;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace PsnClient.Utils
|
||||
namespace PsnClient.Utils;
|
||||
|
||||
public static class TmdbHasher
|
||||
{
|
||||
public static class TmdbHasher
|
||||
{
|
||||
private static readonly byte[] HmacKey = "F5DE66D2680E255B2DF79E74F890EBF349262F618BCAE2A9ACCDEE5156CE8DF2CDF2D48C71173CDC2594465B87405D197CF1AED3B7E9671EEB56CA6753C2E6B0".FromHexString();
|
||||
|
||||
public static string GetTitleHash(string productId)
|
||||
@@ -39,5 +39,4 @@ namespace PsnClient.Utils
|
||||
result.Append(b.ToString("X2"));
|
||||
return result.ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,10 @@ using System.Text.Json.Serialization;
|
||||
using CompatApiClient.Formatters;
|
||||
using YandexDiskClient.POCOs;
|
||||
|
||||
namespace YandexDiskClient
|
||||
namespace YandexDiskClient;
|
||||
|
||||
public sealed class Client
|
||||
{
|
||||
public sealed class Client
|
||||
{
|
||||
private readonly HttpClient client;
|
||||
private readonly JsonSerializerOptions jsonOptions;
|
||||
|
||||
@@ -60,5 +60,4 @@ namespace YandexDiskClient
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
namespace YandexDiskClient.POCOs
|
||||
{
|
||||
#nullable disable
|
||||
namespace YandexDiskClient.POCOs;
|
||||
#nullable disable
|
||||
|
||||
public sealed class ResourceInfo
|
||||
{
|
||||
public sealed class ResourceInfo
|
||||
{
|
||||
public int? Size;
|
||||
public string Name; //RPCS3.log.gz
|
||||
public string PublicKey;
|
||||
@@ -14,7 +13,6 @@
|
||||
public string Md5;
|
||||
public string Sha256;
|
||||
public long? Revision;
|
||||
}
|
||||
|
||||
#nullable restore
|
||||
}
|
||||
|
||||
#nullable restore
|
||||
@@ -4,10 +4,10 @@ using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.Entities;
|
||||
|
||||
namespace CompatBot.Commands.Attributes
|
||||
namespace CompatBot.Commands.Attributes;
|
||||
|
||||
internal abstract class CheckBaseAttributeWithReactions: CheckBaseAttribute
|
||||
{
|
||||
internal abstract class CheckBaseAttributeWithReactions: CheckBaseAttribute
|
||||
{
|
||||
protected abstract Task<bool> IsAllowed(CommandContext ctx, bool help);
|
||||
|
||||
public DiscordEmoji? ReactOnSuccess { get; }
|
||||
@@ -35,5 +35,4 @@ namespace CompatBot.Commands.Attributes
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,11 @@ using System.Threading.Tasks;
|
||||
using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
|
||||
namespace CompatBot.Commands.Attributes
|
||||
namespace CompatBot.Commands.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class LimitedToHelpChannel: CheckBaseAttribute
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class LimitedToHelpChannel: CheckBaseAttribute
|
||||
{
|
||||
public override async Task<bool> ExecuteCheckAsync(CommandContext ctx, bool help)
|
||||
{
|
||||
if (ctx.Channel.IsPrivate || help)
|
||||
@@ -19,5 +19,4 @@ namespace CompatBot.Commands.Attributes
|
||||
await ctx.Channel.SendMessageAsync($"`{ctx.Prefix}{ctx.Command?.QualifiedName ?? ctx.RawArgumentString}` is limited to help channel and DMs").ConfigureAwait(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,11 @@ using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.Entities;
|
||||
|
||||
namespace CompatBot.Commands.Attributes
|
||||
namespace CompatBot.Commands.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class LimitedToOfftopicChannel: CheckBaseAttribute
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class LimitedToOfftopicChannel: CheckBaseAttribute
|
||||
{
|
||||
public override async Task<bool> ExecuteCheckAsync(CommandContext ctx, bool help)
|
||||
{
|
||||
if (help || LimitedToSpamChannel.IsSpamChannel(ctx.Channel) || IsOfftopicChannel(ctx.Channel))
|
||||
@@ -42,5 +42,4 @@ namespace CompatBot.Commands.Attributes
|
||||
return channel.Name.Contains("off-topic", StringComparison.InvariantCultureIgnoreCase)
|
||||
|| channel.Name.Contains("offtopic", StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,11 +7,11 @@ using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.Entities;
|
||||
|
||||
namespace CompatBot.Commands.Attributes
|
||||
namespace CompatBot.Commands.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class LimitedToSpamChannel: CheckBaseAttribute
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class LimitedToSpamChannel: CheckBaseAttribute
|
||||
{
|
||||
public override async Task<bool> ExecuteCheckAsync(CommandContext ctx, bool help)
|
||||
{
|
||||
if (help || IsSpamChannel(ctx.Channel))
|
||||
@@ -42,5 +42,4 @@ namespace CompatBot.Commands.Attributes
|
||||
{
|
||||
return channel.IsPrivate || channel.Name.Contains("spam", StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,16 +3,15 @@ using System.Threading.Tasks;
|
||||
using CompatBot.Database.Providers;
|
||||
using DSharpPlus.CommandsNext;
|
||||
|
||||
namespace CompatBot.Commands.Attributes
|
||||
namespace CompatBot.Commands.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class RequiresBotModRole: CheckBaseAttributeWithReactions
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class RequiresBotModRole: CheckBaseAttributeWithReactions
|
||||
{
|
||||
public RequiresBotModRole() : base(reactOnFailure: Config.Reactions.Denied) { }
|
||||
|
||||
protected override Task<bool> IsAllowed(CommandContext ctx, bool help)
|
||||
{
|
||||
return Task.FromResult(ModProvider.IsMod(ctx.User.Id));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,14 +3,13 @@ using System.Threading.Tasks;
|
||||
using CompatBot.Utils;
|
||||
using DSharpPlus.CommandsNext;
|
||||
|
||||
namespace CompatBot.Commands.Attributes
|
||||
namespace CompatBot.Commands.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class RequiresBotSudoerRole: CheckBaseAttributeWithReactions
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class RequiresBotSudoerRole: CheckBaseAttributeWithReactions
|
||||
{
|
||||
public RequiresBotSudoerRole(): base(reactOnFailure: Config.Reactions.Denied) { }
|
||||
|
||||
protected override Task<bool> IsAllowed(CommandContext ctx, bool help)
|
||||
=> Task.FromResult(ctx.User.IsModerator(ctx.Client, ctx.Guild));
|
||||
}
|
||||
}
|
||||
@@ -6,11 +6,11 @@ using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.Entities;
|
||||
|
||||
namespace CompatBot.Commands.Attributes
|
||||
namespace CompatBot.Commands.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class RequiresDm: CheckBaseAttribute
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class RequiresDm: CheckBaseAttribute
|
||||
{
|
||||
private const string Source = "https://cdn.discordapp.com/attachments/417347469521715210/534798232858001418/24qx11.jpg";
|
||||
private static readonly Lazy<byte[]> Poster = new(() =>
|
||||
{
|
||||
@@ -27,5 +27,4 @@ namespace CompatBot.Commands.Attributes
|
||||
await ctx.Channel.SendMessageAsync(new DiscordMessageBuilder().WithFile("senpai_plz.jpg", stream)).ConfigureAwait(false);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,14 +3,13 @@ using System.Threading.Tasks;
|
||||
using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
|
||||
namespace CompatBot.Commands.Attributes
|
||||
namespace CompatBot.Commands.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class RequiresNotMedia: CheckBaseAttribute
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class RequiresNotMedia: CheckBaseAttribute
|
||||
{
|
||||
public override Task<bool> ExecuteCheckAsync(CommandContext ctx, bool help)
|
||||
{
|
||||
return Task.FromResult(ctx.Channel.Name != "media");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,16 +3,15 @@ using System.Threading.Tasks;
|
||||
using CompatBot.Utils;
|
||||
using DSharpPlus.CommandsNext;
|
||||
|
||||
namespace CompatBot.Commands.Attributes
|
||||
namespace CompatBot.Commands.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class RequiresSupporterRole: CheckBaseAttributeWithReactions
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class RequiresSupporterRole: CheckBaseAttributeWithReactions
|
||||
{
|
||||
public RequiresSupporterRole() : base(reactOnFailure: Config.Reactions.Denied) { }
|
||||
|
||||
protected override Task<bool> IsAllowed(CommandContext ctx, bool help)
|
||||
{
|
||||
return Task.FromResult(ctx.User.IsWhitelisted(ctx.Client, ctx.Guild) || ctx.User.IsSupporter(ctx.Client, ctx.Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,16 +3,15 @@ using System.Threading.Tasks;
|
||||
using CompatBot.Utils;
|
||||
using DSharpPlus.CommandsNext;
|
||||
|
||||
namespace CompatBot.Commands.Attributes
|
||||
namespace CompatBot.Commands.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class RequiresWhitelistedRole: CheckBaseAttributeWithReactions
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class RequiresWhitelistedRole: CheckBaseAttributeWithReactions
|
||||
{
|
||||
public RequiresWhitelistedRole() : base(reactOnFailure: Config.Reactions.Denied) { }
|
||||
|
||||
protected override Task<bool> IsAllowed(CommandContext ctx, bool help)
|
||||
{
|
||||
return Task.FromResult(ctx.User.IsWhitelisted(ctx.Client, ctx.Guild));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,15 @@
|
||||
using System;
|
||||
using DSharpPlus.CommandsNext;
|
||||
|
||||
namespace CompatBot.Commands.Attributes
|
||||
namespace CompatBot.Commands.Attributes;
|
||||
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class TriggersTyping: Attribute
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method | AttributeTargets.Class, Inherited = false)]
|
||||
internal class TriggersTyping: Attribute
|
||||
{
|
||||
public bool InDmOnly { get; set; }
|
||||
|
||||
public bool ExecuteCheck(CommandContext ctx)
|
||||
{
|
||||
return !InDmOnly || ctx.Channel.IsPrivate;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,10 @@ using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.Entities;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
internal class BaseCommandModuleCustom : BaseCommandModule
|
||||
{
|
||||
internal class BaseCommandModuleCustom : BaseCommandModule
|
||||
{
|
||||
private DateTimeOffset executionStart;
|
||||
|
||||
public override async Task BeforeExecutionAsync(CommandContext ctx)
|
||||
@@ -76,5 +76,4 @@ namespace CompatBot.Commands
|
||||
|
||||
private static bool TriggersTyping(CommandContext ctx)
|
||||
=> ctx.Command?.CustomAttributes.OfType<TriggersTyping>().FirstOrDefault() is TriggersTyping a && a.ExecuteCheck(ctx);
|
||||
}
|
||||
}
|
||||
@@ -6,12 +6,12 @@ using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using org.mariuszgromada.math.mxparser;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
[Group("math")]
|
||||
[Description("Math, here you go Juhn. Use `math help` for syntax help")]
|
||||
internal sealed class BotMath : BaseCommandModuleCustom
|
||||
{
|
||||
[Group("math")]
|
||||
[Description("Math, here you go Juhn. Use `math help` for syntax help")]
|
||||
internal sealed class BotMath : BaseCommandModuleCustom
|
||||
{
|
||||
[GroupCommand, Priority(9)]
|
||||
public async Task Expression(CommandContext ctx, [RemainingText, Description("Math expression")] string expression)
|
||||
{
|
||||
@@ -46,5 +46,4 @@ namespace CompatBot.Commands
|
||||
[Description("General math expression help, or description of specific math word")]
|
||||
public Task Help(CommandContext ctx)
|
||||
=> ctx.Channel.SendMessageAsync("Help for all the features and built-in constants and functions could be found at <https://mathparser.org/mxparser-math-collection/>");
|
||||
}
|
||||
}
|
||||
@@ -17,11 +17,11 @@ using DSharpPlus.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
[Group("stats")]
|
||||
internal sealed class BotStats: BaseCommandModuleCustom
|
||||
{
|
||||
[Group("stats")]
|
||||
internal sealed class BotStats: BaseCommandModuleCustom
|
||||
{
|
||||
[GroupCommand]
|
||||
[Description("Use to look at various runtime stats")]
|
||||
public async Task Show(CommandContext ctx)
|
||||
@@ -276,5 +276,4 @@ namespace CompatBot.Commands
|
||||
internal static readonly string[] GoodDog = {"🐶", "🐕", "🐩", "🐕🦺",};
|
||||
internal static readonly string[] GoodKot = {"😸", "😺", "😻", "😽",};
|
||||
private static readonly string[] MeanKot = {"🙀", "😿", "😾",};
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,12 @@ using CompatBot.Utils;
|
||||
using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
[Group("commands"), Aliases("command"), RequiresBotModRole]
|
||||
[Description("Used to enable and disable bot commands at runtime")]
|
||||
public sealed class CommandsManagement : BaseCommandModule
|
||||
{
|
||||
[Group("commands"), Aliases("command"), RequiresBotModRole]
|
||||
[Description("Used to enable and disable bot commands at runtime")]
|
||||
public sealed class CommandsManagement : BaseCommandModule
|
||||
{
|
||||
[Command("list"), Aliases("show")]
|
||||
[Description("Lists the disabled commands")]
|
||||
public async Task List(CommandContext ctx)
|
||||
@@ -193,5 +193,4 @@ namespace CompatBot.Commands
|
||||
foreach (var subCmd in group.Children)
|
||||
EnableSubcommands(ctx, subCmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,10 +30,10 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using Microsoft.TeamFoundation.Build.WebApi;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
internal sealed class CompatList : BaseCommandModuleCustom
|
||||
{
|
||||
internal sealed class CompatList : BaseCommandModuleCustom
|
||||
{
|
||||
private static readonly Client Client = new();
|
||||
private static readonly GithubClient.Client GithubClient = new(Config.GithubToken);
|
||||
private static readonly SemaphoreSlim UpdateCheck = new(1, 1);
|
||||
@@ -720,5 +720,4 @@ namespace CompatBot.Commands
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -25,12 +25,12 @@ using DSharpPlus.Interactivity.Extensions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Exception = System.Exception;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
[Group("filters"), Aliases("piracy", "filter"), RequiresBotSudoerRole, RequiresDm]
|
||||
[Description("Used to manage content filters. **Works only in DM**")]
|
||||
internal sealed class ContentFilters: BaseCommandModuleCustom
|
||||
{
|
||||
[Group("filters"), Aliases("piracy", "filter"), RequiresBotSudoerRole, RequiresDm]
|
||||
[Description("Used to manage content filters. **Works only in DM**")]
|
||||
internal sealed class ContentFilters: BaseCommandModuleCustom
|
||||
{
|
||||
private static readonly TimeSpan InteractTimeout = TimeSpan.FromMinutes(5);
|
||||
private static readonly char[] Separators = {' ', ',', ';', '|'};
|
||||
private static readonly SemaphoreSlim ImportLock = new(1, 1);
|
||||
@@ -928,5 +928,4 @@ namespace CompatBot.Commands
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,10 @@ using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Converters;
|
||||
using DSharpPlus.Entities;
|
||||
|
||||
namespace CompatBot.Commands.Converters
|
||||
namespace CompatBot.Commands.Converters;
|
||||
|
||||
internal sealed class TextOnlyDiscordChannelConverter : IArgumentConverter<DiscordChannel>
|
||||
{
|
||||
internal sealed class TextOnlyDiscordChannelConverter : IArgumentConverter<DiscordChannel>
|
||||
{
|
||||
private static Regex ChannelRegex { get; } = new(@"^<#(\d+)>$", RegexOptions.ECMAScript | RegexOptions.Compiled);
|
||||
|
||||
Task<Optional<DiscordChannel>> IArgumentConverter<DiscordChannel>.ConvertAsync(string value, CommandContext ctx)
|
||||
@@ -59,5 +59,4 @@ namespace CompatBot.Commands.Converters
|
||||
).FirstOrDefault(xc => xc.Value?.Name.ToLowerInvariant() == value && xc.Value?.Type == ChannelType.Text);
|
||||
return chn.Value == null ? Optional.FromNoValue<DiscordChannel>() : Optional.FromValue(chn.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,10 @@ using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.Entities;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
internal sealed class DevOnly : BaseCommandModuleCustom
|
||||
{
|
||||
internal sealed class DevOnly : BaseCommandModuleCustom
|
||||
{
|
||||
[Command("whitespacetest"), Aliases("wst", "wstest")]
|
||||
[Description("Testing discord embeds breakage for whitespaces")]
|
||||
public async Task WhitespaceTest(CommandContext ctx)
|
||||
@@ -66,5 +66,4 @@ namespace CompatBot.Commands
|
||||
);
|
||||
await ctx.RespondAsync(builder).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,12 @@ using CompatBot.Commands.Attributes;
|
||||
using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
[Group("e3")]
|
||||
[Description("Provides information about the E3 event")]
|
||||
internal sealed class E3: EventsBaseCommand
|
||||
{
|
||||
[Group("e3")]
|
||||
[Description("Provides information about the E3 event")]
|
||||
internal sealed class E3: EventsBaseCommand
|
||||
{
|
||||
[GroupCommand]
|
||||
public Task E3Countdown(CommandContext ctx)
|
||||
=> NearestEvent(ctx, "E3");
|
||||
@@ -43,5 +43,4 @@ namespace CompatBot.Commands
|
||||
[Description("Provides countdown for the nearest known E3 event")]
|
||||
public Task Countdown(CommandContext ctx)
|
||||
=> E3Countdown(ctx);
|
||||
}
|
||||
}
|
||||
@@ -3,12 +3,12 @@ using CompatBot.Commands.Attributes;
|
||||
using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
[Group("event"), Aliases("events", "e")]
|
||||
[Description("Provides information about the various events in the game industry")]
|
||||
internal sealed class Events: EventsBaseCommand
|
||||
{
|
||||
[Group("event"), Aliases("events", "e")]
|
||||
[Description("Provides information about the various events in the game industry")]
|
||||
internal sealed class Events: EventsBaseCommand
|
||||
{
|
||||
[GroupCommand]
|
||||
public Task NearestGenericEvent(CommandContext ctx, [Description("Optional event name"), RemainingText] string? eventName = null)
|
||||
=> NearestEvent(ctx, eventName);
|
||||
@@ -58,5 +58,4 @@ namespace CompatBot.Commands
|
||||
[Description("Provides countdown for the nearest known event")]
|
||||
public Task Countdown(CommandContext ctx, string? eventName = null)
|
||||
=> NearestEvent(ctx, eventName);
|
||||
}
|
||||
}
|
||||
@@ -17,10 +17,10 @@ using DSharpPlus.EventArgs;
|
||||
using DSharpPlus.Interactivity.Extensions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
internal class EventsBaseCommand: BaseCommandModuleCustom
|
||||
{
|
||||
internal class EventsBaseCommand: BaseCommandModuleCustom
|
||||
{
|
||||
private static readonly TimeSpan InteractTimeout = TimeSpan.FromMinutes(5);
|
||||
private static readonly Regex Duration = new(@"((?<days>\d+)(\.|d\s*))?((?<hours>\d+)(\:|h\s*))?((?<mins>\d+)m?)?",
|
||||
RegexOptions.Compiled | RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.ExplicitCapture);
|
||||
@@ -615,5 +615,4 @@ namespace CompatBot.Commands
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,13 +19,13 @@ using DSharpPlus.Interactivity.Extensions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
[Group("explain"), Aliases("botsplain", "define")]
|
||||
[Cooldown(1, 3, CooldownBucketType.Channel)]
|
||||
[Description("Used to manage and show explanations")]
|
||||
internal sealed class Explain: BaseCommandModuleCustom
|
||||
{
|
||||
[Group("explain"), Aliases("botsplain", "define")]
|
||||
[Cooldown(1, 3, CooldownBucketType.Channel)]
|
||||
[Description("Used to manage and show explanations")]
|
||||
internal sealed class Explain: BaseCommandModuleCustom
|
||||
{
|
||||
private const string TermListTitle = "Defined terms";
|
||||
|
||||
[GroupCommand]
|
||||
@@ -443,5 +443,4 @@ namespace CompatBot.Commands
|
||||
await ctx.Channel.SendMessageAsync(new DiscordMessageBuilder().WithFile("explanation.txt", stream)).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,12 +13,12 @@ using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
[Group("rename")]
|
||||
[Description("Manage users who has forced nickname.")]
|
||||
internal sealed class ForcedNicknames : BaseCommandModuleCustom
|
||||
{
|
||||
[Group("rename")]
|
||||
[Description("Manage users who has forced nickname.")]
|
||||
internal sealed class ForcedNicknames : BaseCommandModuleCustom
|
||||
{
|
||||
[GroupCommand]
|
||||
[Description("Enforces specific nickname for particular user.")]
|
||||
public async Task Rename(CommandContext ctx,
|
||||
@@ -251,5 +251,4 @@ namespace CompatBot.Commands
|
||||
}
|
||||
await ctx.SendAutosplitMessageAsync(table.ToString()).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,12 +15,12 @@ using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
[Group("fortune"), Aliases("fortunes")]
|
||||
[Description("Gives you a fortune once a day")]
|
||||
internal sealed class Fortune : BaseCommandModuleCustom
|
||||
{
|
||||
[Group("fortune"), Aliases("fortunes")]
|
||||
[Description("Gives you a fortune once a day")]
|
||||
internal sealed class Fortune : BaseCommandModuleCustom
|
||||
{
|
||||
private static readonly SemaphoreSlim ImportCheck = new(1, 1);
|
||||
|
||||
[GroupCommand]
|
||||
@@ -257,5 +257,4 @@ namespace CompatBot.Commands
|
||||
var count = await db.SaveChangesAsync(Config.Cts.Token).ConfigureAwait(false);
|
||||
await ctx.ReactWithAsync(Config.Reactions.Success, $"Removed {count} fortune{(count == 1 ? "" : "s")}", true).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,12 +13,12 @@ using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
[Group("invite"), Aliases("invites"), RequiresBotModRole]
|
||||
[Description("Used to manage Discord invites whitelist")]
|
||||
internal sealed class Invites: BaseCommandModuleCustom
|
||||
{
|
||||
[Group("invite"), Aliases("invites"), RequiresBotModRole]
|
||||
[Description("Used to manage Discord invites whitelist")]
|
||||
internal sealed class Invites: BaseCommandModuleCustom
|
||||
{
|
||||
[Command("list"), Aliases("show")]
|
||||
[Description("Lists all filters")]
|
||||
public async Task List(CommandContext ctx)
|
||||
@@ -174,5 +174,4 @@ namespace CompatBot.Commands
|
||||
await ctx.ReactWithAsync(Config.Reactions.Success, $"Invite{StringUtils.GetSuffix(ids.Length)} successfully removed!").ConfigureAwait(false);
|
||||
await List(ctx).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,10 @@ using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using IrdLibraryClient;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
internal sealed class Ird: BaseCommandModuleCustom
|
||||
{
|
||||
internal sealed class Ird: BaseCommandModuleCustom
|
||||
{
|
||||
private static readonly IrdClient Client = new();
|
||||
|
||||
[Command("ird"), TriggersTyping]
|
||||
@@ -26,5 +26,4 @@ namespace CompatBot.Commands
|
||||
var embed = result.AsEmbed();
|
||||
await ctx.Channel.SendMessageAsync(embed: embed).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,13 +6,13 @@ using CompatBot.Commands.Attributes;
|
||||
using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
[Group("minesweeper"), Aliases("msgen")]
|
||||
[LimitedToOfftopicChannel, Cooldown(1, 30, CooldownBucketType.Channel)]
|
||||
[Description("Generates a minesweeper field with specified parameters")]
|
||||
internal sealed class Minesweeper : BaseCommandModuleCustom
|
||||
{
|
||||
[Group("minesweeper"), Aliases("msgen")]
|
||||
[LimitedToOfftopicChannel, Cooldown(1, 30, CooldownBucketType.Channel)]
|
||||
[Description("Generates a minesweeper field with specified parameters")]
|
||||
internal sealed class Minesweeper : BaseCommandModuleCustom
|
||||
{
|
||||
//private static readonly string[] Numbers = {"0️⃣", "1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣",};
|
||||
private static readonly string[] Numbers = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",};
|
||||
private static readonly string[] Bombs = {"*", "◎"};
|
||||
@@ -134,5 +134,4 @@ namespace CompatBot.Commands
|
||||
result[y, x] = countMines(x, y);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,10 +14,10 @@ using DSharpPlus.Entities;
|
||||
using HomoglyphConverter;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
internal sealed class Misc: BaseCommandModuleCustom
|
||||
{
|
||||
internal sealed class Misc: BaseCommandModuleCustom
|
||||
{
|
||||
private static readonly Random rng = new();
|
||||
|
||||
private static readonly List<string> EightBallAnswers = new()
|
||||
@@ -552,5 +552,4 @@ namespace CompatBot.Commands
|
||||
else
|
||||
await ctx.ReactWithAsync(Config.Reactions.Failure, "Invalid product code").ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,10 +15,10 @@ using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.Entities;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
internal sealed partial class Moderation
|
||||
{
|
||||
internal sealed partial class Moderation
|
||||
{
|
||||
[Group("audit"), RequiresBotModRole]
|
||||
[Description("Commands to audit server things")]
|
||||
public sealed class Audit: BaseCommandModuleCustom
|
||||
@@ -320,5 +320,4 @@ namespace CompatBot.Commands
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,10 @@ using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.Entities;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
internal sealed partial class Moderation: BaseCommandModuleCustom
|
||||
{
|
||||
internal sealed partial class Moderation: BaseCommandModuleCustom
|
||||
{
|
||||
[Command("report"), RequiresWhitelistedRole]
|
||||
[Description("Adds specified message to the moderation queue")]
|
||||
public async Task Report(CommandContext ctx, [Description("Message ID from current channel to report")] ulong messageId, [RemainingText, Description("Optional report comment")] string? comment = null)
|
||||
@@ -169,5 +169,4 @@ namespace CompatBot.Commands
|
||||
await msg.ReactWithAsync(Config.Reactions.Moderated).ConfigureAwait(false);
|
||||
await ctx.ReactWithAsync(Config.Reactions.Success, "Message reported").ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,12 +14,12 @@ using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.Entities;
|
||||
using TaskStatus = CirrusCiClient.Generated.TaskStatus;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
[Group("pr"), TriggersTyping]
|
||||
[Description("Commands to list opened pull requests information")]
|
||||
internal sealed class Pr: BaseCommandModuleCustom
|
||||
{
|
||||
[Group("pr"), TriggersTyping]
|
||||
[Description("Commands to list opened pull requests information")]
|
||||
internal sealed class Pr: BaseCommandModuleCustom
|
||||
{
|
||||
private static readonly GithubClient.Client GithubClient = new(Config.GithubToken);
|
||||
private static readonly CompatApiClient.Client CompatApiClient = new();
|
||||
|
||||
@@ -301,5 +301,4 @@ namespace CompatBot.Commands
|
||||
|
||||
await message.Channel.SendMessageAsync(embed: issueInfo.AsEmbed()).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,10 +19,10 @@ using DSharpPlus.Entities;
|
||||
using DSharpPlus.Interactivity.Extensions;
|
||||
using PsnClient.POCOs;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
internal sealed partial class Psn
|
||||
{
|
||||
internal sealed partial class Psn
|
||||
{
|
||||
[Group("check")]
|
||||
[Description("Commands to check for various stuff on PSN")]
|
||||
public sealed class Check: BaseCommandModuleCustom
|
||||
@@ -222,5 +222,4 @@ namespace CompatBot.Commands
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,12 @@ using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using PsnClient;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
[Group("psn")]
|
||||
[Description("Commands related to PSN metadata")]
|
||||
internal sealed partial class Psn: BaseCommandModuleCustom
|
||||
{
|
||||
[Group("psn")]
|
||||
[Description("Commands related to PSN metadata")]
|
||||
internal sealed partial class Psn: BaseCommandModuleCustom
|
||||
{
|
||||
private static readonly Client Client = new();
|
||||
|
||||
[Command("rename"), Aliases("setname", "settitle"), RequiresBotModRole]
|
||||
@@ -74,5 +74,4 @@ namespace CompatBot.Commands
|
||||
else
|
||||
await ctx.ReactWithAsync(Config.Reactions.Failure, $"Product code {contentId} already exists", true).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,10 @@ using DSharpPlus.Entities;
|
||||
using DSharpPlus.SlashCommands;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
internal sealed class SlashTest: ApplicationCommandModule
|
||||
{
|
||||
internal sealed class SlashTest: ApplicationCommandModule
|
||||
{
|
||||
[SlashCommand("credits", "Author Credit")]
|
||||
// TODO [Aliases("about")]
|
||||
public async Task About(InteractionContext ctx)
|
||||
@@ -33,5 +33,4 @@ namespace CompatBot.Commands
|
||||
await ctx.CreateResponseAsync(InteractionResponseType.ChannelMessageWithSource, new DiscordInteractionResponseBuilder().AddEmbed(embed.Build()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,10 @@ using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
internal partial class Sudo
|
||||
{
|
||||
internal partial class Sudo
|
||||
{
|
||||
public sealed partial class Bot
|
||||
{
|
||||
[Group("config"), RequiresBotSudoerRole]
|
||||
@@ -80,5 +80,4 @@ namespace CompatBot.Commands
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,10 +13,10 @@ using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
internal partial class Sudo
|
||||
{
|
||||
internal partial class Sudo
|
||||
{
|
||||
private static readonly SemaphoreSlim LockObj = new(1, 1);
|
||||
private static readonly SemaphoreSlim ImportLockObj = new(1, 1);
|
||||
private static readonly ProcessStartInfo RestartInfo = new("dotnet", $"run -c Release");
|
||||
@@ -239,5 +239,4 @@ namespace CompatBot.Commands
|
||||
Environment.Exit(-1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,10 @@ using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.Entities;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
internal partial class Sudo
|
||||
{
|
||||
internal partial class Sudo
|
||||
{
|
||||
[Group("dotnet")]
|
||||
[Description("Commands to manage dotnet")]
|
||||
public sealed partial class Dotnet : BaseCommandModuleCustom
|
||||
@@ -104,5 +104,4 @@ namespace CompatBot.Commands
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,10 +9,10 @@ using CompatBot.Utils;
|
||||
using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
internal sealed partial class Sudo
|
||||
{
|
||||
internal sealed partial class Sudo
|
||||
{
|
||||
// '2018-06-09 08:20:44.968000 - '
|
||||
// '2018-07-19T12:19:06.7888609Z - '
|
||||
private static readonly Regex Timestamp = new(@"^(?<cutout>(?<date>\d{4}-\d\d-\d\d[ T][0-9:\.]+Z?) - )", RegexOptions.ExplicitCapture | RegexOptions.Singleline);
|
||||
@@ -172,5 +172,4 @@ namespace CompatBot.Commands
|
||||
return msg;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,10 +6,10 @@ using DSharpPlus.CommandsNext;
|
||||
using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.Entities;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
internal partial class Sudo
|
||||
{
|
||||
internal partial class Sudo
|
||||
{
|
||||
[Group("mod")]
|
||||
[Description("Used to manage bot moderators")]
|
||||
public sealed class Mod : BaseCommandModuleCustom
|
||||
@@ -94,5 +94,4 @@ namespace CompatBot.Commands
|
||||
await ctx.ReactWithAsync(Config.Reactions.Failure, $"{sudoer.Mention} is not even a moderator!").ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -19,12 +19,12 @@ using SharpCompress.Compressors.Deflate;
|
||||
using SharpCompress.Writers;
|
||||
using SharpCompress.Writers.Zip;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
[Group("sudo"), RequiresBotSudoerRole]
|
||||
[Description("Used to manage bot moderators and sudoers")]
|
||||
internal sealed partial class Sudo : BaseCommandModuleCustom
|
||||
{
|
||||
[Group("sudo"), RequiresBotSudoerRole]
|
||||
[Description("Used to manage bot moderators and sudoers")]
|
||||
internal sealed partial class Sudo : BaseCommandModuleCustom
|
||||
{
|
||||
[Command("say")]
|
||||
[Description("Make bot say things. Specify #channel or put message link in the beginning to specify where to reply")]
|
||||
public async Task Say(CommandContext ctx, [RemainingText, Description("Message text to send")] string message)
|
||||
@@ -207,5 +207,4 @@ namespace CompatBot.Commands
|
||||
System.Security.Cryptography.RandomNumberGenerator.Fill(salt);
|
||||
return new Bot.Configuration().Set(ctx, nameof(Config.CryptoSalt), Convert.ToBase64String(salt));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,12 +13,12 @@ using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
[Group("syscall"), Aliases("syscalls", "cell", "sce", "scecall", "scecalls"), LimitedToSpamChannel]
|
||||
[Description("Provides information about syscalls used by games")]
|
||||
internal sealed class Syscall: BaseCommandModuleCustom
|
||||
{
|
||||
[Group("syscall"), Aliases("syscalls", "cell", "sce", "scecall", "scecalls"), LimitedToSpamChannel]
|
||||
[Description("Provides information about syscalls used by games")]
|
||||
internal sealed class Syscall: BaseCommandModuleCustom
|
||||
{
|
||||
[GroupCommand]
|
||||
public async Task Search(CommandContext ctx, [RemainingText, Description("Product ID, module, or function name. **Case sensitive**")] string search)
|
||||
{
|
||||
@@ -174,5 +174,4 @@ namespace CompatBot.Commands
|
||||
else
|
||||
await ctx.Channel.SendMessageAsync($"No information available for `{title}`").ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -32,11 +32,11 @@ using RectangleF = SixLabors.ImageSharp.RectangleF;
|
||||
using Size = SixLabors.ImageSharp.Size;
|
||||
using SystemFonts = SixLabors.Fonts.SystemFonts;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
[Cooldown(1, 5, CooldownBucketType.Channel)]
|
||||
internal sealed class Vision: BaseCommandModuleCustom
|
||||
{
|
||||
[Cooldown(1, 5, CooldownBucketType.Channel)]
|
||||
internal sealed class Vision: BaseCommandModuleCustom
|
||||
{
|
||||
static Vision()
|
||||
{
|
||||
var list = new StringBuilder("Available system fonts:").AppendLine();
|
||||
@@ -470,5 +470,4 @@ namespace CompatBot.Commands
|
||||
}
|
||||
return imageUrl;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,10 +12,10 @@ using DSharpPlus.CommandsNext.Attributes;
|
||||
using DSharpPlus.CommandsNext.Converters;
|
||||
using DSharpPlus.Entities;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
internal sealed partial class Warnings
|
||||
{
|
||||
internal sealed partial class Warnings
|
||||
{
|
||||
[Group("list"), Aliases("show")]
|
||||
[Description("Allows to list warnings in various ways. Users can only see their own warnings.")]
|
||||
public class ListGroup : BaseCommandModuleCustom
|
||||
@@ -216,5 +216,4 @@ namespace CompatBot.Commands
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,12 +13,12 @@ using DSharpPlus.Entities;
|
||||
using DSharpPlus.Interactivity.Extensions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompatBot.Commands
|
||||
namespace CompatBot.Commands;
|
||||
|
||||
[Group("warn")]
|
||||
[Description("Command used to manage warnings")]
|
||||
internal sealed partial class Warnings: BaseCommandModuleCustom
|
||||
{
|
||||
[Group("warn")]
|
||||
[Description("Command used to manage warnings")]
|
||||
internal sealed partial class Warnings: BaseCommandModuleCustom
|
||||
{
|
||||
[GroupCommand] //attributes on overloads do not work, so no easy permission checks
|
||||
[Description("Command used to issue a new warning")]
|
||||
public async Task Warn(CommandContext ctx, [Description("User to warn. Can also use @id")] DiscordUser user, [RemainingText, Description("Warning explanation")] string reason)
|
||||
@@ -340,5 +340,4 @@ namespace CompatBot.Commands
|
||||
Config.Log.Warn(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -26,10 +26,10 @@ using NLog.Targets.Wrappers;
|
||||
using ILogger = NLog.ILogger;
|
||||
using LogLevel = NLog.LogLevel;
|
||||
|
||||
namespace CompatBot
|
||||
namespace CompatBot;
|
||||
|
||||
internal static class Config
|
||||
{
|
||||
internal static class Config
|
||||
{
|
||||
private static IConfigurationRoot config = null!;
|
||||
private static TelemetryClient? telemetryClient;
|
||||
private static readonly DependencyTrackingTelemetryModule DependencyTrackingTelemetryModule = new();
|
||||
@@ -318,5 +318,4 @@ namespace CompatBot
|
||||
return telemetryClient = new TelemetryClient(telemetryConfig);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,10 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
using CompatApiClient;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompatBot.Database
|
||||
namespace CompatBot.Database;
|
||||
|
||||
internal class BotDb: DbContext
|
||||
{
|
||||
internal class BotDb: DbContext
|
||||
{
|
||||
public DbSet<BotState> BotState { get; set; } = null!;
|
||||
public DbSet<Moderator> Moderator { get; set; } = null!;
|
||||
public DbSet<Piracystring> Piracystring { get; set; } = null!;
|
||||
@@ -55,25 +55,25 @@ namespace CompatBot.Database
|
||||
//configure name conversion for all configured entities from CamelCase to snake_case
|
||||
modelBuilder.ConfigureMapping(NamingStyles.Underscore);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal class BotState
|
||||
{
|
||||
internal class BotState
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public string Key { get; set; } = null!;
|
||||
public string? Value { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
internal class Moderator
|
||||
{
|
||||
internal class Moderator
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public ulong DiscordId { get; set; }
|
||||
public bool Sudoer { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class Piracystring
|
||||
{
|
||||
public class Piracystring
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required, Column(TypeName = "varchar(255)")]
|
||||
public string String { get; set; } = null!;
|
||||
@@ -83,25 +83,25 @@ namespace CompatBot.Database
|
||||
public string? ExplainTerm { get; set; }
|
||||
public string? CustomMessage { get; set; }
|
||||
public bool Disabled { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
public class SuspiciousString
|
||||
{
|
||||
public class SuspiciousString
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public string String { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum FilterContext: byte
|
||||
{
|
||||
[Flags]
|
||||
public enum FilterContext: byte
|
||||
{
|
||||
Chat = 0b_0000_0001,
|
||||
Log = 0b_0000_0010,
|
||||
}
|
||||
}
|
||||
|
||||
[Flags]
|
||||
public enum FilterAction
|
||||
{
|
||||
[Flags]
|
||||
public enum FilterAction
|
||||
{
|
||||
//None = 0b_0000_0000, do NOT add this
|
||||
RemoveContent = 0b_0000_0001,
|
||||
IssueWarning = 0b_0000_0010,
|
||||
@@ -109,10 +109,10 @@ namespace CompatBot.Database
|
||||
SendMessage = 0b_0000_1000,
|
||||
MuteModQueue = 0b_0001_0000,
|
||||
Kick = 0b_0010_0000,
|
||||
}
|
||||
}
|
||||
|
||||
internal class Warning
|
||||
{
|
||||
internal class Warning
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public ulong DiscordId { get; set; }
|
||||
public ulong IssuerId { get; set; }
|
||||
@@ -125,10 +125,10 @@ namespace CompatBot.Database
|
||||
public ulong? RetractedBy { get; set; }
|
||||
public string? RetractionReason { get; set; }
|
||||
public long? RetractionTimestamp { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
internal class Explanation
|
||||
{
|
||||
internal class Explanation
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public string Keyword { get; set; } = null!;
|
||||
@@ -137,35 +137,35 @@ namespace CompatBot.Database
|
||||
[MaxLength(7*1024*1024)]
|
||||
public byte[]? Attachment { get; set; }
|
||||
public string? AttachmentFilename { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
internal class DisabledCommand
|
||||
{
|
||||
internal class DisabledCommand
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public string Command { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
|
||||
internal class WhitelistedInvite
|
||||
{
|
||||
internal class WhitelistedInvite
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public ulong GuildId { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? InviteCode { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
internal class EventSchedule
|
||||
{
|
||||
internal class EventSchedule
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public int Year { get; set; }
|
||||
public long Start { get; set; }
|
||||
public long End { get; set; }
|
||||
public string? Name { get; set; }
|
||||
public string? EventName { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
internal class Stats
|
||||
{
|
||||
internal class Stats
|
||||
{
|
||||
public int Id { get; set; }
|
||||
[Required]
|
||||
public string Category { get; set; } = null!;
|
||||
@@ -173,26 +173,25 @@ namespace CompatBot.Database
|
||||
public string Key { get; set; } = null!;
|
||||
public int Value { get; set; }
|
||||
public long ExpirationTimestamp { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
internal class Kot
|
||||
{
|
||||
internal class Kot
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public ulong UserId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
internal class Doggo
|
||||
{
|
||||
internal class Doggo
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public ulong UserId { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
internal class ForcedNickname
|
||||
{
|
||||
internal class ForcedNickname
|
||||
{
|
||||
public int Id { get; set; }
|
||||
public ulong GuildId { set; get; }
|
||||
public ulong UserId { set; get; }
|
||||
[Required]
|
||||
public string Nickname { get; set; } = null!;
|
||||
}
|
||||
}
|
||||
@@ -11,10 +11,10 @@ using Microsoft.Data.Sqlite;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Migrations.Internal;
|
||||
|
||||
namespace CompatBot.Database
|
||||
namespace CompatBot.Database;
|
||||
|
||||
public static class DbImporter
|
||||
{
|
||||
public static class DbImporter
|
||||
{
|
||||
public static async Task<bool> UpgradeAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
await using (var db = new BotDb())
|
||||
@@ -265,5 +265,4 @@ namespace CompatBot.Database
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,10 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompatBot.Database
|
||||
namespace CompatBot.Database;
|
||||
|
||||
internal static class NamingConventionConverter
|
||||
{
|
||||
internal static class NamingConventionConverter
|
||||
{
|
||||
public static void ConfigureMapping(this ModelBuilder modelBuilder, Func<string, string> nameResolver)
|
||||
{
|
||||
if (nameResolver == null)
|
||||
@@ -27,5 +27,4 @@ namespace CompatBot.Database
|
||||
index.SetDatabaseName(nameResolver(dbName));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
using System.Linq;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace CompatBot.Database
|
||||
namespace CompatBot.Database;
|
||||
|
||||
internal static class PrimaryKeyConvention
|
||||
{
|
||||
internal static class PrimaryKeyConvention
|
||||
{
|
||||
public static void ConfigureDefaultPkConvention(this ModelBuilder modelBuilder, string keyProperty = "Id")
|
||||
{
|
||||
if (string.IsNullOrEmpty(keyProperty))
|
||||
@@ -27,5 +27,4 @@ namespace CompatBot.Database
|
||||
entity.RemoveKey(pk.Properties);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,10 +7,10 @@ using System.Threading.Tasks;
|
||||
using System.Xml.Linq;
|
||||
using CompatApiClient.Compression;
|
||||
|
||||
namespace CompatBot.Database.Providers
|
||||
namespace CompatBot.Database.Providers;
|
||||
|
||||
internal static class AmdDriverVersionProvider
|
||||
{
|
||||
internal static class AmdDriverVersionProvider
|
||||
{
|
||||
private static readonly Dictionary<string, List<string>> VulkanToDriver = new();
|
||||
private static readonly Dictionary<string, string> OpenglToDriver = new();
|
||||
private static readonly SemaphoreSlim SyncObj = new(1, 1);
|
||||
@@ -166,5 +166,4 @@ namespace CompatBot.Database.Providers
|
||||
|
||||
return vulkanVersion;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,10 +13,10 @@ using Microsoft.EntityFrameworkCore;
|
||||
using NReco.Text;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
|
||||
namespace CompatBot.Database.Providers
|
||||
namespace CompatBot.Database.Providers;
|
||||
|
||||
internal static class ContentFilter
|
||||
{
|
||||
internal static class ContentFilter
|
||||
{
|
||||
private static Dictionary<FilterContext, AhoCorasickDoubleArrayTrie<Piracystring>?> filters = new();
|
||||
private static readonly MemoryCache ResponseAntispamCache = new(new MemoryCacheOptions{ ExpirationScanFrequency = TimeSpan.FromMinutes(5)});
|
||||
private static readonly MemoryCache ReportAntispamCache = new(new MemoryCacheOptions{ ExpirationScanFrequency = TimeSpan.FromMinutes(5)});
|
||||
@@ -266,5 +266,4 @@ namespace CompatBot.Database.Providers
|
||||
&& m.Groups.Count > 0
|
||||
? m.Groups[0].Value.Trim(256)
|
||||
: null;
|
||||
}
|
||||
}
|
||||
@@ -2,10 +2,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace CompatBot.Database.Providers
|
||||
namespace CompatBot.Database.Providers;
|
||||
|
||||
internal static class DisabledCommandsProvider
|
||||
{
|
||||
internal static class DisabledCommandsProvider
|
||||
{
|
||||
private static readonly HashSet<string> DisabledCommands = new(StringComparer.InvariantCultureIgnoreCase);
|
||||
|
||||
static DisabledCommandsProvider()
|
||||
@@ -56,5 +56,4 @@ namespace CompatBot.Database.Providers
|
||||
db.SaveChanges();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user