mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-10 07:47:53 +00:00
Merge remote-tracking branch 'upstream/main' into rust-command-parser
This commit is contained in:
commit
f721b850d4
183 changed files with 5121 additions and 1909 deletions
|
|
@ -55,7 +55,9 @@ public class MessageCreated: IEventHandler<MessageCreateEvent>
|
|||
public (ulong?, ulong?) ErrorChannelFor(MessageCreateEvent evt, ulong userId) => (evt.GuildId, evt.ChannelId);
|
||||
private bool IsDuplicateMessage(Message msg) =>
|
||||
// We consider a message duplicate if it has the same ID as the previous message that hit the gateway
|
||||
_lastMessageCache.GetLastMessage(msg.ChannelId)?.Current.Id == msg.Id;
|
||||
// use only the local cache here
|
||||
// http gateway sets last message before forwarding the message here, so this will always return true
|
||||
_lastMessageCache._GetLastMessage(msg.ChannelId)?.Current.Id == msg.Id;
|
||||
|
||||
public async Task Handle(int shardId, MessageCreateEvent evt)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ public class MessageEdited: IEventHandler<MessageUpdateEvent>
|
|||
var guild = await _cache.TryGetGuild(channel.GuildId!.Value);
|
||||
if (guild == null)
|
||||
throw new Exception("could not find self guild in MessageEdited event");
|
||||
var lastMessage = _lastMessageCache.GetLastMessage(evt.ChannelId)?.Current;
|
||||
var lastMessage = (await _lastMessageCache.GetLastMessage(evt.GuildId.HasValue ? evt.GuildId.Value ?? 0 : 0, evt.ChannelId))?.Current;
|
||||
|
||||
// Only react to the last message in the channel
|
||||
if (lastMessage?.Id != evt.Id)
|
||||
|
|
@ -107,10 +107,6 @@ public class MessageEdited: IEventHandler<MessageUpdateEvent>
|
|||
? new Message.Reference(channel.GuildId, evt.ChannelId, lastMessage.ReferencedMessage.Value)
|
||||
: null;
|
||||
|
||||
var messageType = lastMessage.ReferencedMessage != null
|
||||
? Message.MessageType.Reply
|
||||
: Message.MessageType.Default;
|
||||
|
||||
// TODO: is this missing anything?
|
||||
var equivalentEvt = new MessageCreateEvent
|
||||
{
|
||||
|
|
@ -123,7 +119,7 @@ public class MessageEdited: IEventHandler<MessageUpdateEvent>
|
|||
Attachments = evt.Attachments.Value ?? Array.Empty<Message.Attachment>(),
|
||||
MessageReference = messageReference,
|
||||
ReferencedMessage = referencedMessage,
|
||||
Type = messageType,
|
||||
Type = evt.Type,
|
||||
};
|
||||
return equivalentEvt;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -111,6 +111,7 @@ public class ReactionAdded: IEventHandler<MessageReactionAddEvent>
|
|||
case "\U0001F514": // Bell
|
||||
case "\U0001F6CE": // Bellhop bell
|
||||
case "\U0001F3D3": // Ping pong paddle (lol)
|
||||
case "\U0001FAD1": // Bell pepper
|
||||
case "\u23F0": // Alarm clock
|
||||
case "\u2757": // Exclamation mark
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue