decord/source/modules/guild_automod/AutomodErrorUtils.tsx

122 lines
3.8 KiB
TypeScript
Raw Normal View History

// Module ID: 8043
// Function ID: 8044
// Name: AutomodErrorUtils
// Dependencies: [1957, 1074, 1114, 7936, 2]
2026-07-20 16:05:17 +00:00
// Exports: getAutomodErrorMessage
// Module 8043 (AutomodErrorUtils)
import util from "util" /* 1114 */;
import ChannelStore from "ChannelStore" /* 1957 */;
2026-07-23 10:11:24 +00:00
require = fn;
2026-07-20 16:05:17 +00:00
function getAutomodErrorMessageFromErrorResponse(errorResponseBody, id) {
if (null == errorResponseBody) {
return null;
} else {
({ code, message } = errorResponseBody);
if (set.has(code)) {
if (null != message) {
return message;
} else if (null == id) {
return null;
} else {
const channel = ChannelStore.getChannel(id);
2026-07-29 08:29:29 +00:00
let isThreadResult;
if (channel != null) {
isThreadResult = channel.isThread();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (isThreadResult) {
const intl3 = util.intl;
return intl3.string(util.t.DVdG9E);
2026-07-29 08:29:29 +00:00
} else {
let isForumPostResult;
if (channel != null) {
isForumPostResult = channel.isForumPost();
}
if (isForumPostResult) {
if (code === AbortCodes.AUTOMOD_TITLE_BLOCKED) {
const intl2 = util.intl;
return intl2.string(util.t.ipgKDg);
2026-07-29 08:29:29 +00:00
} else if (code === tmp4.AUTOMOD_MESSAGE_BLOCKED) {
const intl = util.intl;
return intl.string(util.t.ipgKDg);
2026-07-29 08:29:29 +00:00
}
} else {
let isForumLikeChannelResult;
if (channel != null) {
isForumLikeChannelResult = channel.isForumLikeChannel();
}
}
2026-07-20 16:05:17 +00:00
return null;
}
}
} else {
return null;
}
}
}
function getAutomodErrorMessageFromMessageData(message) {
const channel = ChannelStore.getChannel(message.message.channelId);
2026-07-20 16:05:17 +00:00
if (obj2.isMessageDataEdit(message)) {
const intl4 = tmp(1114).intl;
let stringResult = intl4.string(tmp(1114).t.bU6o0z);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
let isThreadResult;
if (channel != null) {
isThreadResult = channel.isThread();
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
if (isThreadResult) {
const intl3 = tmp(1114).intl;
stringResult = intl3.string(tmp(1114).t.DVdG9E);
2026-07-29 08:29:29 +00:00
} else {
let isForumPostResult;
if (channel != null) {
isForumPostResult = channel.isForumPost();
}
if (!isForumPostResult) {
let isForumLikeChannelResult;
if (channel != null) {
isForumLikeChannelResult = channel.isForumLikeChannel();
}
if (!isForumLikeChannelResult) {
const intl = tmp(1114).intl;
stringResult = intl.string(tmp(1114).t.zQ69pv);
2026-07-29 08:29:29 +00:00
}
}
const intl2 = tmp(1114).intl;
stringResult = intl2.string(tmp(1114).t.ipgKDg);
2026-07-20 16:05:17 +00:00
}
}
return stringResult;
}
const AbortCodes = fn(1074).AbortCodes;
2026-07-29 08:29:29 +00:00
class InvalidKeywordError extends Error {
}
const prototype = function InvalidRegexPatternError() {
2026-07-29 08:29:29 +00:00
return HermesBuiltin.applyArguments(new.target, new.target);
}.prototype;
class prototype extends Error {
}
const items = [, , ];
2026-07-20 16:05:17 +00:00
({ AUTOMOD_MESSAGE_BLOCKED: arr[0], AUTOMOD_TITLE_BLOCKED: arr[1], AUTOMOD_INVALID_RUST_SERVICE_RESPONSE: arr[2] } = AbortCodes);
const set = new Set(items);
const size = fn(2);
const result = size.fileFinishedImporting("modules/guild_automod/AutomodErrorUtils.tsx");
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
export { InvalidKeywordError };
export const InvalidRegexPatternError = prototype;
2026-07-20 16:05:17 +00:00
export const AUTOMOD_ERROR_CODES = set;
export { getAutomodErrorMessageFromErrorResponse };
export { getAutomodErrorMessageFromMessageData };
export const getAutomodErrorMessage = function getAutomodErrorMessage(messageData, errorResponseBody) {
const tmp = getAutomodErrorMessageFromErrorResponse(errorResponseBody);
if (null != tmp) {
return tmp;
} else if (null == messageData) {
const intl = util.intl;
let stringResult = intl.string(util.t.zQ69pv);
2026-07-20 16:05:17 +00:00
} else {
stringResult = getAutomodErrorMessageFromMessageData(messageData);
}
};