From 857b0488b942d1aeb01f339fbe5b274ef7b5d2e3 Mon Sep 17 00:00:00 2001 From: Ske Date: Sun, 22 Dec 2019 13:54:18 +0100 Subject: [PATCH] Add member pinging by reaction --- PluralKit.Bot/Services/ProxyService.cs | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/PluralKit.Bot/Services/ProxyService.cs b/PluralKit.Bot/Services/ProxyService.cs index ee7c816b..65e62760 100644 --- a/PluralKit.Bot/Services/ProxyService.cs +++ b/PluralKit.Bot/Services/ProxyService.cs @@ -181,11 +181,31 @@ namespace PluralKit.Bot case "\u2753": // Red question mark case "\u2754": // White question mark return HandleMessageQueryByReaction(message, reaction.UserId, reaction.Emote); + case "\U0001F514": // Bell + case "\U0001F6CE": // Bellhop bell + case "\U0001F3D3": // Ping pong paddle (lol) + case "\u23F0": // Alarm clock + case "\u2757": // Exclamation mark + return HandleMessagePingByReaction(message, channel, reaction.UserId); default: return Task.CompletedTask; } } + private async Task HandleMessagePingByReaction(Cacheable message, + ISocketMessageChannel channel, ulong userWhoReacted) + { + // Find the message in the DB + var msg = await _data.GetMessage(message.Id); + if (msg == null) return; + + var realMessage = await message.GetOrDownloadAsync(); + var embed = new EmbedBuilder() + .WithDescription($"[Jump to pinged message]({realMessage.GetJumpUrl()})"); + + await channel.SendMessageAsync($"Psst, **{msg.Member.DisplayName ?? msg.Member.Name}** (<@{msg.Message.Sender}>), you have been pinged by <@{userWhoReacted}>.", embed: embed.Build()); + } + private async Task HandleMessageQueryByReaction(Cacheable message, ulong userWhoReacted, IEmote reactedEmote) { // Find the user who sent the reaction, so we can DM them