3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-07-06 10:37:19 +00:00
This commit is contained in:
rubyowo 2025-06-30 22:27:35 +01:00 committed by GitHub
commit cf388cb16a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -31,18 +31,19 @@ export const ReplyAction = automodAction({
async apply({ pluginData, contexts, actionConfig, ruleName }) { async apply({ pluginData, contexts, actionConfig, ruleName }) {
const contextsWithTextChannels = contexts const contextsWithTextChannels = contexts
.filter((c) => c.message?.channel_id) .filter((c) => c.channel?.id ?? c.message?.channel_id)
.filter((c) => { .filter((c) => {
const channel = pluginData.guild.channels.cache.get(c.message!.channel_id as Snowflake); const channel = pluginData.guild.channels.cache.get(c.channel?.id || c.message!.channel_id as Snowflake);
return channel?.isTextBased(); return channel?.isTextBased();
}); });
const contextsByChannelId = contextsWithTextChannels.reduce((map: Map<string, AutomodContext[]>, context) => { const contextsByChannelId = contextsWithTextChannels.reduce((map: Map<string, AutomodContext[]>, context) => {
if (!map.has(context.message!.channel_id)) { const channelId = context.channel?.id ?? context.message!.channel_id
map.set(context.message!.channel_id, []); if (!map.has(channelId)) {
map.set(channelId, []);
} }
map.get(context.message!.channel_id)!.push(context); map.get(channelId)!.push(context);
return map; return map;
}, new Map()); }, new Map());