mirror of
https://github.com/TeamOctolings/Octobot.git
synced 2025-01-31 09:09:00 +03:00
Octol1ttle
84e730838b
*I'll start working on features and bugfixes after this PR, I promise* very short summary: - no more braceless statements - braces are on new lines now - `sealed` on everything that can be `sealed` - no more awkwardly looking alignment of fields/parameters - no more `Service` suffix on service fields. yeah. - no more `else`s. who needs them? - code style is now enforced by CI --------- Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
using JetBrains.Annotations;
|
||
using Remora.Discord.API.Abstractions.Gateway.Events;
|
||
using Remora.Discord.API.Abstractions.Rest;
|
||
using Remora.Discord.Gateway.Responders;
|
||
using Remora.Rest.Core;
|
||
using Remora.Results;
|
||
|
||
namespace Boyfriend.Responders;
|
||
|
||
/// <summary>
|
||
/// Handles sending replies to easter egg messages.
|
||
/// </summary>
|
||
[UsedImplicitly]
|
||
public class MessageCreateResponder : IResponder<IMessageCreate>
|
||
{
|
||
private readonly IDiscordRestChannelAPI _channelApi;
|
||
|
||
public MessageCreateResponder(IDiscordRestChannelAPI channelApi)
|
||
{
|
||
_channelApi = channelApi;
|
||
}
|
||
|
||
public Task<Result> RespondAsync(IMessageCreate gatewayEvent, CancellationToken ct = default)
|
||
{
|
||
_ = _channelApi.CreateMessageAsync(
|
||
gatewayEvent.ChannelID, ct: ct, content: gatewayEvent.Content.ToLowerInvariant() switch
|
||
{
|
||
"whoami" => "`nobody`",
|
||
"сука !!" => "`root`",
|
||
"воооо" => "`removing /...`",
|
||
"пон" => "https://cdn.upload.systems/uploads/2LNfUSwM.jpg",
|
||
"++++" => "#",
|
||
"осу" => "https://github.com/ppy/osu",
|
||
_ => default(Optional<string>)
|
||
});
|
||
return Task.FromResult(Result.FromSuccess());
|
||
}
|
||
}
|