mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-09 07:17:40 +00:00
fix: process Discord DM reactions instead of silently dropping them
This commit is contained in:
@@ -188,10 +188,6 @@ async function handleDiscordReactionEvent(params: {
|
||||
if (!user || user.bot) {
|
||||
return;
|
||||
}
|
||||
if (!data.guild_id) {
|
||||
return;
|
||||
}
|
||||
|
||||
const guildInfo = resolveDiscordGuildEntry({
|
||||
guild: data.guild ?? undefined,
|
||||
guildEntries,
|
||||
@@ -207,6 +203,8 @@ async function handleDiscordReactionEvent(params: {
|
||||
const channelName = "name" in channel ? (channel.name ?? undefined) : undefined;
|
||||
const channelSlug = channelName ? normalizeDiscordSlug(channelName) : "";
|
||||
const channelType = "type" in channel ? channel.type : undefined;
|
||||
const isDirectMessage = channelType === ChannelType.DM;
|
||||
const isGroupDm = channelType === ChannelType.GroupDM;
|
||||
const isThreadChannel =
|
||||
channelType === ChannelType.PublicThread ||
|
||||
channelType === ChannelType.PrivateThread ||
|
||||
@@ -262,7 +260,8 @@ async function handleDiscordReactionEvent(params: {
|
||||
const emojiLabel = formatDiscordReactionEmoji(data.emoji);
|
||||
const actorLabel = formatDiscordUserTag(user);
|
||||
const guildSlug =
|
||||
guildInfo?.slug || (data.guild?.name ? normalizeDiscordSlug(data.guild.name) : data.guild_id);
|
||||
guildInfo?.slug ||
|
||||
(data.guild?.name ? normalizeDiscordSlug(data.guild.name) : (data.guild_id ?? "dm"));
|
||||
const channelLabel = channelSlug
|
||||
? `#${channelSlug}`
|
||||
: channelName
|
||||
@@ -276,7 +275,10 @@ async function handleDiscordReactionEvent(params: {
|
||||
channel: "discord",
|
||||
accountId: params.accountId,
|
||||
guildId: data.guild_id ?? undefined,
|
||||
peer: { kind: "channel", id: data.channel_id },
|
||||
peer: {
|
||||
kind: isDirectMessage ? "dm" : isGroupDm ? "group" : "channel",
|
||||
id: isDirectMessage ? user.id : data.channel_id,
|
||||
},
|
||||
parentPeer: parentId ? { kind: "channel", id: parentId } : undefined,
|
||||
});
|
||||
enqueueSystemEvent(text, {
|
||||
|
||||
Reference in New Issue
Block a user