decord/source/modules/messages/LegacyCommands.tsx

180 lines
5.7 KiB
TypeScript
Raw Normal View History

2026-08-25 06:04:03 +00:00
// Module ID: 11566
// Function ID: 11567
2026-07-29 08:29:29 +00:00
// Name: action
2026-08-25 06:04:03 +00:00
// Dependencies: [32, 5282, 4623, 676, 4070, 8507, 4096, 7367, 4036, 7063, 4588, 2]
2026-07-20 16:05:17 +00:00
// Exports: handleLegacyCommands
2026-08-25 06:04:03 +00:00
// Module 11566 (action)
import MAX_REACTIONS from "MAX_REACTIONS" /* 4036 */;
import explicitContentFromProto from "explicitContentFromProto" /* 4070 */;
import collectGuildAnalyticsMetadataDefault from "collectGuildAnalyticsMetadata" /* 4588 */;
import trackInviteDefault from "trackInvite" /* 7063 */;
import checkReactionResponse from "checkReactionResponse" /* 7367 */;
import _modDef8507 from "module_8507" /* 8507 */;
2026-08-24 06:08:38 +00:00
import closure_3 from "_slicedToArray" /* 32 */;
2026-08-25 06:04:03 +00:00
import closure_4 from "getEmojiToGroupId" /* 5282 */;
import closure_5 from "reinjectEphemerals" /* 4623 */;
2026-08-24 06:08:38 +00:00
import ME from "ME" /* 676 */;
2026-08-25 06:04:03 +00:00
import importDefaultResult from "t" /* 4096 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
({ AnalyticEvents: closure_6, MARKDOWN_SPOILER_WRAPPER: error, ME: closure_8 } = ME);
2026-07-23 10:11:24 +00:00
const re9 = /\\([*?+/])/g;
2026-07-29 08:29:29 +00:00
obj = { tts: obj, me: obj, tableflip: obj1, unflip: obj2, shrug: obj3, nick: obj4, reaction: null, searchReplace: null, spoiler: null };
2026-07-20 16:05:17 +00:00
obj = {
action() {
2026-08-24 06:08:38 +00:00
obj = { tts: null };
const EnableTTSCommand = explicitContentFromProto.EnableTTSCommand;
2026-07-29 08:29:29 +00:00
obj[0] = EnableTTSCommand.getSetting();
2026-07-20 16:05:17 +00:00
return obj;
}
};
obj = {
action(arg0) {
return { content: "_" + arg0 + "_" };
}
};
2026-08-24 06:08:38 +00:00
const obj5 = {
match: importDefaultResult.anyScopeRegex(/^\+:(.+?): *$/),
action(str, channel) {
channel = channel.channel;
if (!channel.isEdit) {
if (closure_5.hasPresent(channel.id)) {
const messages = obj.getMessages(channel.id);
const lastResult = messages.last();
if (null != lastResult) {
if (null != lastResult.id) {
disambiguatedEmojiContext = disambiguatedEmojiContext.getDisambiguatedEmojiContext(channel.guild_id);
const trimmed = str.trim();
const byName = disambiguatedEmojiContext.getByName(trimmed.slice(2, -1));
if (null != byName) {
const obj3 = checkReactionResponse;
obj3.addReaction(channel.id, lastResult.id, MAX_REACTIONS.toReactionEmoji(byName));
return { content: "" };
}
2026-07-23 10:11:24 +00:00
}
}
}
2026-08-24 06:08:38 +00:00
obj = closure_5;
2026-07-23 10:11:24 +00:00
}
}
};
2026-07-29 08:29:29 +00:00
obj[6] = obj5;
const obj6 = { match: null, action: null };
2026-07-23 10:11:24 +00:00
obj1 = {
2026-07-20 16:05:17 +00:00
action(arg0) {
2026-08-24 06:08:38 +00:00
obj = { content: "" + arg0 + " (\u256F\u00B0\u25A1\u00B0)\u256F\uFE35 \u253B\u2501\u253B".trim() };
2026-07-20 16:05:17 +00:00
return obj;
}
};
2026-07-23 10:11:24 +00:00
obj2 = {
2026-07-20 16:05:17 +00:00
action(arg0) {
2026-08-24 06:08:38 +00:00
obj = { content: "" + arg0 + " \u252C\u2500\u252C\u30CE( \u00BA _ \u00BA\u30CE)".trim() };
2026-07-20 16:05:17 +00:00
return obj;
}
};
2026-07-23 10:11:24 +00:00
obj3 = {
2026-07-20 16:05:17 +00:00
action(arg0) {
2026-08-24 06:08:38 +00:00
obj = { content: "" + arg0 + " \u00AF\\_(\u30C4)_/\u00AF".trim() };
2026-07-20 16:05:17 +00:00
return obj;
}
};
2026-07-23 10:11:24 +00:00
obj4 = {
2026-07-20 16:05:17 +00:00
action(arg0, channel) {
channel = channel.channel;
if (null != channel.guild_id) {
2026-08-25 06:04:03 +00:00
obj = _modDef8507;
2026-07-20 16:05:17 +00:00
obj.changeNickname(channel.guild_id, channel.id, closure_8, arg0);
2026-07-29 08:29:29 +00:00
return { content: "" };
2026-07-20 16:05:17 +00:00
}
}
};
2026-08-24 06:08:38 +00:00
obj6[0] = importDefaultResult.anyScopeRegex(/^s\/([^\/\\]*(?:\\.[^\/\\]*)*)\/([^\/\\]*(?:\\.[^\/\\]*)*)(?:\/([g]*))?$/);
2026-07-29 08:29:29 +00:00
obj6[1] = function action(str, channel) {
2026-07-20 16:05:17 +00:00
channel = channel.channel;
if (!channel.isEdit) {
2026-08-24 06:08:38 +00:00
const lastEditableMessage = closure_5.getLastEditableMessage(channel.id);
2026-07-20 16:05:17 +00:00
if (null != lastEditableMessage) {
if (null != lastEditableMessage.id) {
const self = this;
let match = str.match(this.match.regex);
2026-07-29 08:29:29 +00:00
if (match == null) {
2026-07-20 16:05:17 +00:00
match = [];
}
2026-07-29 08:29:29 +00:00
[r10014, str, str2, str3] = callback(Array.from(match), 4);
2026-07-20 16:05:17 +00:00
let parts;
2026-07-29 08:29:29 +00:00
if (str3 != null) {
2026-07-20 16:05:17 +00:00
parts = str3.split("");
}
2026-07-29 08:29:29 +00:00
if (parts == null) {
2026-07-20 16:05:17 +00:00
parts = [];
}
2026-07-29 08:29:29 +00:00
const replaced = str.replace(closure_9, (arg0, arg1) => arg1);
const replaced1 = str2.replace(closure_9, (arg0, arg1) => arg1);
2026-07-20 16:05:17 +00:00
if (parts.includes("g")) {
let str7 = str6.replaceAll(replaced, replaced1);
} else {
str7 = str6.replace(replaced, replaced1);
}
if (null == str7) {
if (0 === lastEditableMessage.attachments.length) {
2026-08-24 06:08:38 +00:00
obj = trackInviteDefault;
2026-07-20 16:05:17 +00:00
obj.deleteMessage(channel.id, lastEditableMessage.id);
}
2026-07-29 08:29:29 +00:00
return { content: "" };
2026-07-20 16:05:17 +00:00
}
if (str7 !== lastEditableMessage.content) {
2026-07-29 08:29:29 +00:00
obj = { content: null };
obj[0] = str7;
2026-08-24 06:08:38 +00:00
trackInviteDefault.editMessage(channel.id, lastEditableMessage.id, obj);
const obj2 = trackInviteDefault;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
const tmp5 = callback(Array.from(match), 4);
2026-07-20 16:05:17 +00:00
}
}
2026-07-29 08:29:29 +00:00
return { content: "" };
2026-07-20 16:05:17 +00:00
}
};
2026-07-29 08:29:29 +00:00
obj[7] = obj6;
obj[8] = {
2026-07-20 16:05:17 +00:00
action(arg0) {
2026-08-24 06:08:38 +00:00
obj = { content: callback2(arg0).trim() };
2026-07-20 16:05:17 +00:00
return obj;
}
};
Object.setPrototypeOf(obj, null);
2026-08-24 06:08:38 +00:00
const importDefaultResult1 = importDefaultResult;
const result = require("set").fileFinishedImporting("modules/messages/LegacyCommands.tsx");
2026-07-20 16:05:17 +00:00
export const COMMANDS = obj;
export const handleLegacyCommands = function handleLegacyCommands(text, arg1) {
2026-07-29 08:29:29 +00:00
for (const key10005 in obj) {
let tmp7 = key10005;
let tmp8 = obj;
let str = obj[key10005];
2026-07-20 16:05:17 +00:00
if (null == str.match) {
continue;
} else {
let regex = str.match.regex;
2026-07-29 08:29:29 +00:00
let isMatch;
if (regex != null) {
isMatch = regex.test(arg0);
}
if (!isMatch) {
2026-07-20 16:05:17 +00:00
continue;
} else {
2026-07-29 08:29:29 +00:00
let tmp2 = arg1;
let tmp3 = importDefault;
let tmp4 = dependencyMap;
2026-08-24 06:08:38 +00:00
obj = collectGuildAnalyticsMetadataDefault;
2026-07-29 08:29:29 +00:00
let tmp5 = constants;
obj = { command: null };
obj[0] = key10005;
let trackWithMetadataResult = obj.trackWithMetadata(constants.SLASH_COMMAND_USED, obj);
return str.action(arg0, arg1);
2026-07-20 16:05:17 +00:00
}
}
continue;
}
};