BirthdayBot/Data/Extensions.cs

22 lines
939 B
C#
Raw Normal View History

2022-03-10 22:09:15 +00:00
namespace BirthdayBot.Data;
internal static class Extensions {
/// <summary>
2022-03-10 22:09:15 +00:00
/// Retrieves the database-backed bot configuration for this guild.
/// </summary>
internal static async Task<GuildConfiguration> GetConfigAsync(this SocketGuild guild)
=> await GuildConfiguration.LoadAsync(guild.Id, false);
/// <summary>
2022-03-10 22:09:15 +00:00
/// Retrieves a collection of all existing user configurations for this guild.
/// </summary>
internal static async Task<IEnumerable<GuildUserConfiguration>> GetUserConfigurationsAsync(this SocketGuild guild)
=> await GuildUserConfiguration.LoadAllAsync(guild.Id);
/// <summary>
/// Retrieves the database-backed bot configuration (birthday info) for this guild user.
/// </summary>
internal static async Task<GuildUserConfiguration> GetConfigAsync(this SocketGuildUser user)
=> await GuildUserConfiguration.LoadAsync(user.Guild.Id, user.Id);
}