26 lines
1.2 KiB
TypeScript
26 lines
1.2 KiB
TypeScript
// Metro module 4998 (f4999).
|
|
import GuildRoleStore from "../../stores/GuildRoleStore";
|
|
import GuildStore from "../../stores/GuildStore";
|
|
import * as _Constants from "../../Constants";
|
|
import { combine, hasAny } from "../../_bundle/HighLow";
|
|
const { ChannelTypes, Permissions } = _Constants;
|
|
let c3006_4 = [ChannelTypes.GUILD_TEXT, ChannelTypes.GUILD_VOICE, ChannelTypes.GUILD_ANNOUNCEMENT, ChannelTypes.GUILD_FORUM, ChannelTypes.PUBLIC_THREAD, ChannelTypes.PRIVATE_THREAD];
|
|
let c3006_5 = combine(Permissions.VIEW_CHANNEL, Permissions.SEND_MESSAGES);
|
|
export default function getConnectionsRoles(a0) {
|
|
if (a0 != null && c3006_4.includes(a0.type)) {
|
|
const guild = GuildStore.getGuild(a0.guild_id);
|
|
return guild == null ? [] : Object.values(a0.permissionOverwrites).filter((item) => {
|
|
let r1 = item.type === 0;
|
|
if (r1) {
|
|
const role = GuildRoleStore.getRole(guild.id, item.id);
|
|
r1 = (role == null ? void 0 : role.tags?.guild_connections) === null;
|
|
}
|
|
if (r1) {
|
|
r1 = !hasAny(item.deny, c3006_5);
|
|
}
|
|
return r1;
|
|
}).map((item) => GuildRoleStore.getRole(guild.id, item.id)).filter((item) => item != null);
|
|
}
|
|
return [];
|
|
};
|