Add a new .editorconfig and reformat code (#76)

*I'll start working on features and bugfixes after this PR, I promise*
very short summary:
- no more braceless statements
- braces are on new lines now
- `sealed` on everything that can be `sealed`
- no more awkwardly looking alignment of fields/parameters
- no more `Service` suffix on service fields. yeah.
- no more `else`s. who needs them?
- code style is now enforced by CI

---------

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-08-03 01:51:16 +05:00 committed by GitHub
parent 4cb39a34b5
commit 84e730838b
Signed by: GitHub
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 2917 additions and 623 deletions

View file

@ -7,19 +7,21 @@ namespace Boyfriend.Data;
/// Stores information about a guild. This information is not accessible via the Discord API.
/// </summary>
/// <remarks>This information is stored on disk as a JSON file.</remarks>
public class GuildData {
public sealed class GuildData
{
public readonly Dictionary<ulong, MemberData> MemberData;
public readonly string MemberDataPath;
public readonly string MemberDataPath;
public readonly Dictionary<ulong, ScheduledEventData> ScheduledEvents;
public readonly string ScheduledEventsPath;
public readonly JsonNode Settings;
public readonly string SettingsPath;
public readonly string ScheduledEventsPath;
public readonly JsonNode Settings;
public readonly string SettingsPath;
public GuildData(
JsonNode settings, string settingsPath,
JsonNode settings, string settingsPath,
Dictionary<ulong, ScheduledEventData> scheduledEvents, string scheduledEventsPath,
Dictionary<ulong, MemberData> memberData, string memberDataPath) {
Dictionary<ulong, MemberData> memberData, string memberDataPath)
{
Settings = settings;
SettingsPath = settingsPath;
ScheduledEvents = scheduledEvents;
@ -28,8 +30,12 @@ public class GuildData {
MemberDataPath = memberDataPath;
}
public MemberData GetMemberData(Snowflake userId) {
if (MemberData.TryGetValue(userId.Value, out var existing)) return existing;
public MemberData GetMemberData(Snowflake userId)
{
if (MemberData.TryGetValue(userId.Value, out var existing))
{
return existing;
}
var newData = new MemberData(userId.Value, null);
MemberData.Add(userId.Value, newData);