Skip to content

Commit 4aa5dce

Browse files
committed
Update BigotryFilter.cs
1 parent 3e85276 commit 4aa5dce

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

common/BigotryFilter.cs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,28 @@ public sealed class BigotryFilter
1111

1212
static BigotryFilter()
1313
{
14-
var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "comroid", "pronouns.txt");
14+
try
15+
{
16+
var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "comroid", "pronouns.txt");
1517

16-
string content;
17-
if (File.Exists(path))
18-
content = File.ReadAllText(path);
19-
else
18+
string content;
19+
if (File.Exists(path))
20+
content = File.ReadAllText(path);
21+
else
22+
{
23+
Console.Write("Please enter your preferred pronouns: ");
24+
content = Console.ReadLine() ?? throw new NullReferenceException("No input detected");
25+
File.WriteAllText(path, content);
26+
}
27+
if (content == string.Empty)
28+
throw new ArgumentException("Please enter your pronouns");
29+
Pronouns = content.Split(Separators, StringSplitOptions.RemoveEmptyEntries);
30+
Log<BigotryFilter>.Config("Found Pronouns: " + string.Join("/", Pronouns));
31+
}
32+
catch (Exception e)
2033
{
21-
Console.Write("Please enter your preferred pronouns: ");
22-
content = Console.ReadLine() ?? throw new NullReferenceException("No input detected");
23-
File.WriteAllText(path, content);
34+
Log<BigotryFilter>.Error("Could not obtain pronouns", e);
2435
}
25-
Pronouns = content.Split(Separators, StringSplitOptions.RemoveEmptyEntries);
26-
Log<BigotryFilter>.Config("Found Pronouns: " + string.Join("/", Pronouns));
2736
}
2837

2938
public static void Init()

0 commit comments

Comments
 (0)