decord/alpha/source/actions/GuildSubscriptionsActionCreators.tsx

83 lines
3.1 KiB
TypeScript
Raw Permalink Normal View History

2026-10-12 06:59:38 +00:00
// Module ID: 7012
// Function ID: 7013
// Name: GuildSubscriptionsActionCreators
2026-10-12 06:59:38 +00:00
// Dependencies: [584, 6984, 2]
2026-07-29 08:29:29 +00:00
// Exports: subscribeChannel, subscribeChannelDimensions, subscribeGuild, subscribeMembers, subscribeToMemberUpdates, unsubscribeFromMemberUpdates, unsubscribeMembers
2026-07-20 16:05:17 +00:00
2026-10-12 06:59:38 +00:00
// Module 7012 (GuildSubscriptionsActionCreators)
2026-10-03 08:58:59 +00:00
import DispatcherDefault from "Dispatcher" /* 584 */;
2026-10-12 06:59:38 +00:00
import GuildChannelSubscriptions from "GuildChannelSubscriptions" /* 6984 */;
import size from "module_2" /* 2 */;
2026-08-24 06:08:38 +00:00
let result = size.fileFinishedImporting("actions/GuildSubscriptionsActionCreators.tsx");
2026-07-20 16:05:17 +00:00
export const subscribeMembers = function subscribeMembers(guildId, userIds) {
2026-10-03 08:58:59 +00:00
const obj = DispatcherDefault;
const obj2 = { type: "GUILD_SUBSCRIPTIONS_MEMBERS_ADD", guildId, userIds };
obj.dispatch(obj2);
2026-07-20 16:05:17 +00:00
};
export const unsubscribeMembers = function unsubscribeMembers(guildId, userIds) {
2026-10-03 08:58:59 +00:00
const obj = DispatcherDefault;
const obj2 = { type: "GUILD_SUBSCRIPTIONS_MEMBERS_REMOVE", guildId, userIds };
obj.dispatch(obj2);
2026-07-20 16:05:17 +00:00
};
export const subscribeToMemberUpdates = function subscribeToMemberUpdates(guildId) {
2026-10-03 08:58:59 +00:00
const obj = DispatcherDefault;
const obj2 = { type: "GUILD_SUBSCRIPTIONS_ADD_MEMBER_UPDATES", guildId };
obj.dispatch(obj2);
2026-07-20 16:05:17 +00:00
};
export const unsubscribeFromMemberUpdates = function unsubscribeFromMemberUpdates(guildId) {
2026-10-03 08:58:59 +00:00
const obj = DispatcherDefault;
const obj2 = { type: "GUILD_SUBSCRIPTIONS_REMOVE_MEMBER_UPDATES", guildId };
obj.dispatch(obj2);
2026-07-20 16:05:17 +00:00
};
export const subscribeGuild = function subscribeGuild(guildId) {
2026-10-03 08:58:59 +00:00
const obj = DispatcherDefault;
const obj2 = { type: "GUILD_SUBSCRIPTIONS", guildId };
obj.dispatch(obj2);
2026-07-29 08:29:29 +00:00
};
export const subscribeChannel = function subscribeChannel(guildId, channelId, ranges) {
2026-10-03 08:58:59 +00:00
const obj = DispatcherDefault;
const obj2 = { type: "GUILD_SUBSCRIPTIONS_CHANNEL", guildId, channelId, ranges };
obj.dispatch(obj2);
2026-07-20 16:05:17 +00:00
};
export const subscribeChannelDimensions = function subscribeChannelDimensions(arg0) {
2026-10-03 08:58:59 +00:00
let channelId;
let guildId;
let height;
let rowHeight;
let y;
2026-07-29 08:29:29 +00:00
({ y, height, rowHeight } = arg0);
2026-07-20 16:05:17 +00:00
({ guildId, channelId } = arg0);
2026-07-29 08:29:29 +00:00
const bound = Math.max(0, Math.ceil(Math.ceil(0.5 * height / rowHeight)));
2026-10-03 08:58:59 +00:00
const tmp2 = -bound;
const bound1 = Math.max(0, Math.ceil(Math.ceil(y / rowHeight)) + tmp2);
2026-07-29 08:29:29 +00:00
let num = bound;
const sum = y + height;
if (bound === undefined) {
num = 0;
}
const items = [];
const bound2 = Math.max(0, Math.ceil(Math.ceil(sum / rowHeight)) + num);
2026-10-03 08:58:59 +00:00
let maxResult = bound1;
2026-07-29 08:29:29 +00:00
if (bound1 > 0) {
2026-07-20 16:05:17 +00:00
const _Math = Math;
const diff = GuildChannelSubscriptions.MINIMUM_RANGE - 1;
2026-07-29 08:29:29 +00:00
const items1 = [0, diff];
items.push(items1);
2026-10-03 08:58:59 +00:00
maxResult = max(diff + 1, bound1);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const rounded = Math.floor(maxResult / GuildChannelSubscriptions.MINIMUM_RANGE);
let result = rounded * GuildChannelSubscriptions.MINIMUM_RANGE;
2026-07-29 08:29:29 +00:00
if (result <= bound2) {
2026-07-20 16:05:17 +00:00
do {
let sum1 = result + (GuildChannelSubscriptions.MINIMUM_RANGE - 1);
2026-07-29 08:29:29 +00:00
let items2 = [result, sum1];
let arr2 = items.push(items2);
2026-07-29 08:29:29 +00:00
result = sum1 + 1;
} while (result <= bound2);
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
const obj = DispatcherDefault;
obj.dispatch({ type: "GUILD_SUBSCRIPTIONS_CHANNEL", guildId, channelId, ranges: items });
2026-07-20 16:05:17 +00:00
};