chore: format with csharpier
This commit is contained in:
parent
2f516dcb73
commit
4f54077c68
59 changed files with 2000 additions and 942 deletions
|
|
@ -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; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue