1
0
Fork 1
mirror of https://github.com/TeamOctolings/Octobot.git synced 2025-04-20 00:43:36 +03:00

Bring back easter eggs

Signed-off-by: Octol1ttle <l1ttleofficial@outlook.com>
This commit is contained in:
Octol1ttle 2023-06-30 15:08:50 +05:00
parent b1855c5257
commit 586e260c92
Signed by: Octol1ttle
GPG key ID: B77C34313AEE1FFF
2 changed files with 29 additions and 1 deletions

View file

@ -11,6 +11,7 @@ using Remora.Discord.Caching.Services;
using Remora.Discord.Extensions.Embeds; using Remora.Discord.Extensions.Embeds;
using Remora.Discord.Extensions.Formatting; using Remora.Discord.Extensions.Formatting;
using Remora.Discord.Gateway.Responders; using Remora.Discord.Gateway.Responders;
using Remora.Rest.Core;
using Remora.Results; using Remora.Results;
// ReSharper disable UnusedType.Global // ReSharper disable UnusedType.Global
@ -305,3 +306,28 @@ public class GuildMemberUpdateResponder : IResponder<IGuildMemberUpdate> {
return Result.FromSuccess(); return Result.FromSuccess();
} }
} }
/// <summary>
/// Handles sending replies to easter egg messages.
/// </summary>
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 switch {
"whoami" => "`nobody`",
"сука !!" => "`root`",
"воооо" => "`removing /...`",
"пон" =>
"https://cdn.discordapp.com/attachments/837385840946053181/1087236080950055023/vUORS10xPaY-1.jpg",
"++++" => "#",
_ => default(Optional<string>)
});
return Task.FromResult(Result.FromSuccess());
}
}

View file

@ -27,7 +27,8 @@ public class GuildUpdateService : BackgroundService {
("Splatoon 3 - Rockagilly Blues (Yoko & the Gold Bazookas)", new TimeSpan(0, 3, 37)), ("Splatoon 3 - Rockagilly Blues (Yoko & the Gold Bazookas)", new TimeSpan(0, 3, 37)),
("Splatoon 3 - Seep and Destroy", new TimeSpan(0, 2, 42)), ("Splatoon 3 - Seep and Destroy", new TimeSpan(0, 2, 42)),
("IA - A Tale of Six Trillion Years and a Night", new TimeSpan(0, 3, 40)), ("IA - A Tale of Six Trillion Years and a Night", new TimeSpan(0, 3, 40)),
("Manuel - Gas Gas Gas", new TimeSpan(0, 3, 17)) ("Manuel - Gas Gas Gas", new TimeSpan(0, 3, 17)),
("Camellia - Flamewall", new TimeSpan(0, 6, 50))
}; };
private readonly List<Activity> _activityList = new(1) { new Activity("with Remora.Discord", ActivityType.Game) }; private readonly List<Activity> _activityList = new(1) { new Activity("with Remora.Discord", ActivityType.Game) };
@ -59,6 +60,7 @@ public class GuildUpdateService : BackgroundService {
/// <summary> /// <summary>
/// Activates a periodic timer with a 1 second interval and adds guild update tasks on each timer tick. /// Activates a periodic timer with a 1 second interval and adds guild update tasks on each timer tick.
/// Additionally, updates the current presence with songs from <see cref="SongList"/>.
/// </summary> /// </summary>
/// <remarks>If update tasks take longer than 1 second, the next timer tick will be skipped.</remarks> /// <remarks>If update tasks take longer than 1 second, the next timer tick will be skipped.</remarks>
/// <param name="ct">The cancellation token for this operation.</param> /// <param name="ct">The cancellation token for this operation.</param>