mirror of
https://github.com/NoiTheCat/BirthdayBot.git
synced 2024-11-24 01:14:12 +00:00
Move Data extensions to a more suitable area
This commit is contained in:
parent
a01b1113f9
commit
7abe03b70d
2 changed files with 21 additions and 17 deletions
|
@ -135,21 +135,4 @@ public abstract class BotModuleBase : InteractionModuleBase<SocketInteractionCon
|
|||
/// </summary>
|
||||
protected static string FormatDate(int month, int day) => $"{day:00}-{Common.MonthNames[month]}";
|
||||
#endregion
|
||||
}
|
||||
|
||||
internal static class Extensions {
|
||||
/// <summary>
|
||||
/// Retrieves the database-backed guild configuration for the executing guild.
|
||||
/// </summary>
|
||||
internal static async Task<GuildConfiguration> GetGuildConfAsync(this SocketInteractionContext context)
|
||||
#pragma warning disable CS8603 // Possible null reference return.
|
||||
=> await GuildConfiguration.LoadAsync(context.Guild.Id, false);
|
||||
#pragma warning restore CS8603 // Possible null reference return.
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the database-backed guild user configuration for the executing user.
|
||||
/// </summary>
|
||||
internal static async Task<GuildUserConfiguration> GetGuildUserConfAsync(this SocketInteractionContext context)
|
||||
=> await GuildUserConfiguration.LoadAsync(context.Guild.Id, context.User.Id);
|
||||
|
||||
}
|
21
Data/Extensions.cs
Normal file
21
Data/Extensions.cs
Normal file
|
@ -0,0 +1,21 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace BirthdayBot.Data;
|
||||
|
||||
internal static class Extensions {
|
||||
/// <summary>
|
||||
/// Retrieves the database-backed guild configuration for the executing guild.
|
||||
/// </summary>
|
||||
internal static async Task<GuildConfiguration> GetConfigAsync(this SocketGuild guild)
|
||||
=> await GuildConfiguration.LoadAsync(guild.Id, false);
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the database-backed guild user configuration for this user.
|
||||
/// </summary>
|
||||
internal static async Task<GuildUserConfiguration> GetConfigAsync(this SocketGuildUser user)
|
||||
=> await GuildUserConfiguration.LoadAsync(user.Guild.Id, user.Id);
|
||||
}
|
Loading…
Reference in a new issue