Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Anti flashy emoji #29

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
1 change: 1 addition & 0 deletions Cliptok.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<PackageReference Include="DSharpPlus.CommandsNext" Version="4.1.0-nightly-00879" />
<PackageReference Include="IDoEverything.DSharpPlus.SlashCommands" Version="1.4.0" />
<PackageReference Include="StackExchange.Redis" Version="2.2.4" />
<PackageReference Include="System.Drawing.Common" Version="5.0.2" />
<PackageReference Include="System.Linq" Version="4.3.0" />
</ItemGroup>

Expand Down
31 changes: 31 additions & 0 deletions Modules/ConfigJson.cs
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,37 @@ public struct ConfigJson
[JsonProperty("supportRatelimitMinutes")]
public int SupportRatelimitMinutes { get; private set; }


[JsonProperty("seizureDetection")]
public SeizureDetectionConfig SeizureDetection { get; private set; }

}

public class SeizureDetectionConfig
{
[JsonProperty("comparisonAccuracy")]
public int ComparisonAccuracy { get; private set; }

[JsonProperty("maxDifferingPixels")]
public int MaxDifferingPixels { get; private set; }

[JsonProperty("maxComparableFrames")]
public int MaxComparableFrames { get; private set; }

[JsonProperty("harmlessAverageFrameDifference")]
public int HarmlessAverageFrameDifference { get; private set; }

[JsonProperty("safeAverageFrameDifference")]
public int SafeAverageFrameDifference { get; private set; }

[JsonProperty("penaltyAverageFrameDifference")]
public int PenaltyAverageFrameDifference { get; private set; }

[JsonProperty("maxAverageFrameDifference")]
public int MaxAverageFrameDifference { get; private set; }

[JsonProperty("unsafeGifValues")]
public List<int> UnsafeGifValues { get; private set; }
[JsonProperty("massMentionBanThreshold")]
public int MassMentionBanThreshold { get; private set; }

Expand Down
18 changes: 18 additions & 0 deletions Modules/GenericModCmds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -836,6 +836,24 @@ public static async Task<bool> CheckRemindersAsync(bool includeRemutes = false)
[HomeServer, RequireHomeserverPerm(ServerPermLevel.Mod)]
class DebugCmds : BaseCommandModule
{
[Command("gif")]
[Description("Debug GIF properties.")]
public async Task GifDebug(CommandContext ctx, string gifToCheck)
{
SeizureDetection.ImageInfo Gif = SeizureDetection.GetGifProperties(gifToCheck);
string strOut = "**GIF information**\n";
strOut += $"----------\nFrame count: **{Gif.FrameCount}**\n";
strOut += $"Unique frame count: **{Gif.UniqueFrameCount}**\n";
strOut += $"Average frame difference: **{Math.Round(Gif.AverageFrameDifference, 2)}**\n";
strOut += $"Average frame contrast: **{Math.Round(Gif.AverageContrast, 2)}**\n";
strOut += $"Length: **{Gif.Length}ms**\n";
strOut += $"Frame duration: **{Math.Round(Gif.Duration, 2)}ms**\n";
strOut += $"Framerate: **{Math.Round(Gif.FrameRate, 2)}fps**\n";
strOut += $"Seizure-inducing: **{Gif.IsSeizureInducing}**\n";
strOut += "----------";
await ctx.RespondAsync(strOut);
}

[Command("mutes")]
[Description("Debug the list of mutes.")]
public async Task MuteDebug(CommandContext ctx)
Expand Down
Loading
Loading