Skip to content

Commit

Permalink
Create BigotryFilter.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
burdoto committed Nov 15, 2023
1 parent 2ba862c commit 3e85276
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions common/BigotryFilter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
using System;
using System.IO;
using JetBrains.Annotations;

namespace comroid.common;

public sealed class BigotryFilter
{
[LanguageInjection("RegExp")] public static readonly string[] Separators = new[] { "/", ",", "\\", " ", "\n", "\r\n" };
public static readonly string[] Pronouns;

static BigotryFilter()
{
var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "comroid", "pronouns.txt");

string content;
if (File.Exists(path))
content = File.ReadAllText(path);
else
{
Console.Write("Please enter your preferred pronouns: ");
content = Console.ReadLine() ?? throw new NullReferenceException("No input detected");
File.WriteAllText(path, content);
}
Pronouns = content.Split(Separators, StringSplitOptions.RemoveEmptyEntries);
Log<BigotryFilter>.Config("Found Pronouns: " + string.Join("/", Pronouns));
}

public static void Init()
{
}
}

0 comments on commit 3e85276

Please sign in to comment.