mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-05-17 03:04:45 +03:00
Apply official naming guidelines to Octobot (#306)
1. The root namespace was changed from `Octobot` to `TeamOctolings.Octobot`: > DO prefix namespace names with a company name to prevent namespaces from different companies from having the same name. 2. `Octobot.cs` was renamed to `Program.cs`: > DO NOT use the same name for a namespace and a type in that namespace. 3. `IOption`, `Option` were renamed to `IGuildOption` and `GuildOption` respectively: > DO NOT introduce generic type names such as Element, Node, Log, and Message. 4. `Utility` was moved out of the `Services` namespace. It didn't belong there anyway 5. `Program` static fields were moved to `Utility` 6. Localisation files were moved back to the project source files. Looks like this fixed `Message.Designer.cs` code generation --------- Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
parent
19fadead91
commit
793afd0e06
61 changed files with 447 additions and 462 deletions
TeamOctolings.Octobot/Data
47
TeamOctolings.Octobot/Data/GuildData.cs
Normal file
47
TeamOctolings.Octobot/Data/GuildData.cs
Normal file
|
@ -0,0 +1,47 @@
|
|||
using System.Text.Json.Nodes;
|
||||
using Remora.Rest.Core;
|
||||
|
||||
namespace TeamOctolings.Octobot.Data;
|
||||
|
||||
/// <summary>
|
||||
/// 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 sealed class GuildData
|
||||
{
|
||||
public readonly Dictionary<ulong, MemberData> MemberData;
|
||||
public readonly string MemberDataPath;
|
||||
|
||||
public readonly Dictionary<ulong, ScheduledEventData> ScheduledEvents;
|
||||
public readonly string ScheduledEventsPath;
|
||||
public readonly JsonNode Settings;
|
||||
public readonly string SettingsPath;
|
||||
|
||||
public readonly bool DataLoadFailed;
|
||||
|
||||
public GuildData(
|
||||
JsonNode settings, string settingsPath,
|
||||
Dictionary<ulong, ScheduledEventData> scheduledEvents, string scheduledEventsPath,
|
||||
Dictionary<ulong, MemberData> memberData, string memberDataPath, bool dataLoadFailed)
|
||||
{
|
||||
Settings = settings;
|
||||
SettingsPath = settingsPath;
|
||||
ScheduledEvents = scheduledEvents;
|
||||
ScheduledEventsPath = scheduledEventsPath;
|
||||
MemberData = memberData;
|
||||
MemberDataPath = memberDataPath;
|
||||
DataLoadFailed = dataLoadFailed;
|
||||
}
|
||||
|
||||
public MemberData GetOrCreateMemberData(Snowflake memberId)
|
||||
{
|
||||
if (MemberData.TryGetValue(memberId.Value, out var existing))
|
||||
{
|
||||
return existing;
|
||||
}
|
||||
|
||||
var newData = new MemberData(memberId.Value);
|
||||
MemberData.Add(memberId.Value, newData);
|
||||
return newData;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue