decord/alpha/source/stores/MessageReactionsStore.tsx

116 lines
3.5 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 06:59:38 +00:00
// Module ID: 7899
// Function ID: 7900
// Name: MessageReactionsStore
2026-10-12 06:59:38 +00:00
// Dependencies: [4751, 1404, 2065, 1390, 504, 7900, 584, 2]
2026-07-23 10:11:24 +00:00
2026-10-12 06:59:38 +00:00
// Module 7899 (MessageReactionsStore)
2026-10-03 08:58:59 +00:00
import get_initializedDefault from "get initialized" /* 504 */;
import DispatcherDefault from "Dispatcher" /* 584 */;
2026-10-12 06:59:38 +00:00
import ReactionActionCreatorsAll from "ReactionActionCreators" /* 7900 */;
2026-10-10 08:08:14 +00:00
import LurkingStore from "LurkingStore" /* 4751 */;
2026-10-09 10:00:15 +00:00
import UserRecord from "UserRecord" /* 1404 */;
2026-10-10 08:08:14 +00:00
import ChannelStore from "ChannelStore" /* 2065 */;
2026-10-09 10:00:15 +00:00
import UserStore from "UserStore" /* 1390 */;
2026-10-03 08:58:59 +00:00
import size from "module_2" /* 2 */;
let closure_6, map, set;
2026-07-20 16:05:17 +00:00
function handleReaction(userId) {
userId = userId.userId;
2026-10-03 08:58:59 +00:00
const type = userId.type;
const ensureResult = Reaction.ensure(userId.messageId, userId.emoji, userId.reactionType);
if ("MESSAGE_REACTION_ADD" === type) {
const user = UserStore.getUser(userId);
2026-07-20 16:05:17 +00:00
if (null != user) {
const users2 = ensureResult.users;
const result = users2.set(userId, user);
}
} else {
const users = ensureResult.users;
users.delete(userId);
}
}
2026-10-03 08:58:59 +00:00
const metroRequire = {};
class Reaction {
constructor() {
const obj = Object.create(new.target.prototype);
obj.fetched = false;
obj.users = new Map();
new Map();
return obj;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
static ensure(arg0, arg1, arg2) {
let id;
let name;
({ name, id } = arg1);
if (id == null) {
id = "";
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const combined = "" + arg0 + ":" + name + ":" + id + ":" + arg2;
let tmp3 = closure_6[combined];
const tmp2 = closure_6;
if (tmp3 == null) {
const self = this;
if (typeof Reaction === "function") {
const obj = Object.create(Reaction.prototype);
obj.fetched = false;
const _Map = Map;
const self2 = this;
const self3 = this;
obj.users = new Map();
tmp3 = obj;
map = new Map();
} else {
throw new TypeError("Trying to call a non-function");
}
}
tmp2[combined] = tmp3;
return tmp3;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
const Store = get_initializedDefault.Store;
class MessageReactionsStore extends Store {
initialize() {
this.waitFor(ChannelStore, LurkingStore, UserStore);
}
getReactions(channelId, messageId, emoji, limit, VOTE) {
const ensureResult = Reaction.ensure(messageId, emoji, VOTE);
if (!ensureResult.fetched) {
const channel = ChannelStore.getChannel(channelId);
let guildId = null;
if (null != channel) {
guildId = channel.getGuildId();
}
const obj = { channelId, messageId, emoji, limit, type: VOTE };
const obj2 = ReactionActionCreatorsAll;
const reactors = obj2.getReactors(obj);
ensureResult.fetched = true;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
return ensureResult.users;
2026-07-29 08:29:29 +00:00
}
2026-10-03 08:58:59 +00:00
}
const prototype = MessageReactionsStore.prototype;
2026-07-29 08:29:29 +00:00
MessageReactionsStore.displayName = "MessageReactionsStore";
2026-10-03 08:58:59 +00:00
let obj = {
2026-07-20 16:05:17 +00:00
CONNECTION_OPEN: function handleConnectionOpen() {
2026-08-24 06:08:38 +00:00
closure_6 = {};
2026-07-20 16:05:17 +00:00
},
MESSAGE_REACTION_ADD: handleReaction,
MESSAGE_REACTION_REMOVE: handleReaction,
MESSAGE_REACTION_ADD_USERS: function handleAddUserReactions(users) {
users = undefined;
2026-10-03 08:58:59 +00:00
users = Reaction.ensure(users.messageId, users.emoji, users.reactionType);
2026-07-20 16:05:17 +00:00
const item = users.forEach((id) => {
2026-07-23 10:11:24 +00:00
users = users.users;
2026-10-03 08:58:59 +00:00
id = id.id;
set = users.set;
const tmp = new UserRecord(id);
return set(id, tmp);
2026-07-20 16:05:17 +00:00
});
}
2026-10-03 08:58:59 +00:00
};
const messageReactionsStore = new MessageReactionsStore(DispatcherDefault, obj);
let result = size.fileFinishedImporting("stores/MessageReactionsStore.tsx");
2026-07-20 16:05:17 +00:00
2026-07-29 08:29:29 +00:00
export default messageReactionsStore;