chore: format with csharpier

This commit is contained in:
sam 2024-10-09 17:35:11 +02:00
parent 2f516dcb73
commit 4f54077c68
59 changed files with 2000 additions and 942 deletions

View file

@ -10,13 +10,21 @@ public interface IWebhookCache
Task<Webhook?> GetWebhookAsync(ulong channelId);
Task SetWebhookAsync(ulong channelId, Webhook webhook);
public async Task<Webhook> GetOrFetchWebhookAsync(ulong channelId, Func<Snowflake, Task<IWebhook>> fetch)
public async Task<Webhook> GetOrFetchWebhookAsync(
ulong channelId,
Func<Snowflake, Task<IWebhook>> fetch
)
{
var webhook = await GetWebhookAsync(channelId);
if (webhook != null) return webhook.Value;
if (webhook != null)
return webhook.Value;
var discordWebhook = await fetch(DiscordSnowflake.New(channelId));
webhook = new Webhook { Id = discordWebhook.ID.ToUlong(), Token = discordWebhook.Token.Value };
webhook = new Webhook
{
Id = discordWebhook.ID.ToUlong(),
Token = discordWebhook.Token.Value,
};
await SetWebhookAsync(channelId, webhook.Value);
return webhook.Value;
}
@ -26,4 +34,4 @@ public struct Webhook
{
public required ulong Id { get; init; }
public required string Token { get; init; }
}
}