mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
fix(bot): check message type in message update events
This commit is contained in:
parent
35090babd4
commit
94a3276979
2 changed files with 3 additions and 5 deletions
|
|
@ -10,6 +10,8 @@ public record MessageUpdateEvent(ulong Id, ulong ChannelId): IGatewayEvent
|
||||||
public Optional<GuildMemberPartial> Member { get; init; }
|
public Optional<GuildMemberPartial> Member { get; init; }
|
||||||
public Optional<Message.Attachment[]> Attachments { get; init; }
|
public Optional<Message.Attachment[]> Attachments { get; init; }
|
||||||
|
|
||||||
|
public Message.MessageType Type { get; init; }
|
||||||
|
|
||||||
public Optional<ulong?> GuildId { get; init; }
|
public Optional<ulong?> GuildId { get; init; }
|
||||||
// TODO: lots of partials
|
// TODO: lots of partials
|
||||||
}
|
}
|
||||||
|
|
@ -107,10 +107,6 @@ public class MessageEdited: IEventHandler<MessageUpdateEvent>
|
||||||
? new Message.Reference(channel.GuildId, evt.ChannelId, lastMessage.ReferencedMessage.Value)
|
? new Message.Reference(channel.GuildId, evt.ChannelId, lastMessage.ReferencedMessage.Value)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
var messageType = lastMessage.ReferencedMessage != null
|
|
||||||
? Message.MessageType.Reply
|
|
||||||
: Message.MessageType.Default;
|
|
||||||
|
|
||||||
// TODO: is this missing anything?
|
// TODO: is this missing anything?
|
||||||
var equivalentEvt = new MessageCreateEvent
|
var equivalentEvt = new MessageCreateEvent
|
||||||
{
|
{
|
||||||
|
|
@ -123,7 +119,7 @@ public class MessageEdited: IEventHandler<MessageUpdateEvent>
|
||||||
Attachments = evt.Attachments.Value ?? Array.Empty<Message.Attachment>(),
|
Attachments = evt.Attachments.Value ?? Array.Empty<Message.Attachment>(),
|
||||||
MessageReference = messageReference,
|
MessageReference = messageReference,
|
||||||
ReferencedMessage = referencedMessage,
|
ReferencedMessage = referencedMessage,
|
||||||
Type = messageType,
|
Type = evt.Type,
|
||||||
};
|
};
|
||||||
return equivalentEvt;
|
return equivalentEvt;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue