2023-07-18 15:25:02 +03:00
|
|
|
|
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;
|
|
|
|
|
|
2023-09-30 16:58:32 +03:00
|
|
|
|
namespace Octobot.Responders;
|
2023-07-18 15:25:02 +03:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Handles sending replies to easter egg messages.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[UsedImplicitly]
|
2023-08-02 23:51:16 +03:00
|
|
|
|
public class MessageCreateResponder : IResponder<IMessageCreate>
|
|
|
|
|
{
|
2023-07-18 15:25:02 +03:00
|
|
|
|
private readonly IDiscordRestChannelAPI _channelApi;
|
|
|
|
|
|
2023-08-02 23:51:16 +03:00
|
|
|
|
public MessageCreateResponder(IDiscordRestChannelAPI channelApi)
|
|
|
|
|
{
|
2023-07-18 15:25:02 +03:00
|
|
|
|
_channelApi = channelApi;
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-02 23:51:16 +03:00
|
|
|
|
public Task<Result> RespondAsync(IMessageCreate gatewayEvent, CancellationToken ct = default)
|
|
|
|
|
{
|
2023-07-18 15:25:02 +03:00
|
|
|
|
_ = _channelApi.CreateMessageAsync(
|
2023-08-02 23:51:16 +03:00
|
|
|
|
gatewayEvent.ChannelID, ct: ct, content: gatewayEvent.Content.ToLowerInvariant() switch
|
|
|
|
|
{
|
|
|
|
|
"whoami" => "`nobody`",
|
2023-07-18 15:25:02 +03:00
|
|
|
|
"сука !!" => "`root`",
|
2023-08-02 23:51:16 +03:00
|
|
|
|
"воооо" => "`removing /...`",
|
2024-01-22 18:47:53 +03:00
|
|
|
|
"пон" => "https://i.ibb.co/Kw6QVcw/parry.jpg",
|
2023-07-18 15:25:02 +03:00
|
|
|
|
"++++" => "#",
|
2023-08-02 23:51:16 +03:00
|
|
|
|
"осу" => "https://github.com/ppy/osu",
|
2024-01-28 15:27:21 +03:00
|
|
|
|
"лан" => "https://i.ibb.co/VYH2QLc/lan.jpg",
|
2023-08-02 23:51:16 +03:00
|
|
|
|
_ => default(Optional<string>)
|
2023-07-18 15:25:02 +03:00
|
|
|
|
});
|
2024-03-21 18:55:34 +03:00
|
|
|
|
return Task.FromResult(Result.Success);
|
2023-07-18 15:25:02 +03:00
|
|
|
|
}
|
|
|
|
|
}
|