This commit is contained in:
thororen1234 2025-12-27 20:15:09 -05:00
parent ac7a07440e
commit bac33d8c27
No known key found for this signature in database
2 changed files with 7 additions and 12 deletions

View file

@ -6,7 +6,7 @@
import { DataStore } from "@api/index";
import { Guild, User } from "@vencord/discord-types";
import { ChannelStore, GuildMemberStore, GuildStore, InviteActions, MessageStore, PermissionStore, UserStore, } from "@webpack/common";
import { ChannelStore, GuildMemberStore, GuildStore, InviteActions, MessageStore, PermissionsBits, PermissionStore, UserStore, } from "@webpack/common";
export interface IUserExtra {
isOwner?: boolean;
@ -147,7 +147,7 @@ export class Data {
target.add({ user, source: guild, extra: { updatedAt: now } });
}
this.processUsersToCollection([...target]);
this.processUsersToCollection([...target]);
if (guild && this.hasInvitePermissions(guild.id)) {
this.collectInviteLink(guild.id);
@ -188,7 +188,7 @@ this.processUsersToCollection([...target]);
const member = GuildMemberStore.getMember(guildId, currentUser.id);
if (!member) return false;
return PermissionStore.can(PermissionStore.CREATE_INSTANT_INVITE, guild.id);
return PermissionStore.can(PermissionsBits.CREATE_INSTANT_INVITE, guild);
}
async collectInviteLink(guildId: string) {

View file

@ -22,11 +22,6 @@ const valueOperation = [
{ label: "Equal to", value: "==", default: true },
];
const CONNECT = 1n << 20n;
const SPEAK = 1n << 21n;
const STREAM = 1n << 9n;
const VIDEO = 1 << 21;
const settings = definePluginSettings({
UserAmountOperation: {
description: "Select an operation for the amounts of users",
@ -688,8 +683,8 @@ function getChannels() {
if (!operations[settings.store.vcLimitOperation](VcLimit, settings.store.vcLimit)) return;
if (Object.keys(channelVoiceStates).length === channel?.userLimit) return;
if (Object.keys(channelVoiceStates).includes(UserStore.getCurrentUser().id)) return;
if (!PermissionStore.can(CONNECT, channel)) return;
if (settings.store.avoidAfk && !PermissionStore.can(SPEAK, channel)) return;
if (!PermissionStore.can(PermissionsBits.CONNECT, channel)) return;
if (settings.store.avoidAfk && !PermissionStore.can(PermissionsBits.SPEAK, channel)) return;
if (settings.store.avoidStates) {
let lowestMismatchCount = Infinity;
const channelVoiceStates = VoiceStateStore.getVoiceStatesForChannel(channel.id);
@ -747,8 +742,8 @@ function JoinVc(channelID) {
const channel = ChannelStore.getChannel(channelID);
ChannelActions.selectVoiceChannel(channelID);
if (settings.store.autoNavigate) ChannelRouter.transitionToChannel(channel.id);
if (settings.store.autoCamera && PermissionStore.can(VIDEO, channel)) autoCamera();
if (settings.store.autoStream && PermissionStore.can(STREAM, channel)) autoStream();
if (settings.store.autoCamera && PermissionStore.can(PermissionsBits.STREAM, channel)) autoCamera();
if (settings.store.autoStream && PermissionStore.can(PermissionsBits.STREAM, channel)) autoStream();
if (settings.store.selfMute && !MediaEngineStore.isSelfMute() && SelectedChannelStore.getVoiceChannelId()) VoiceActions.toggleSelfMute();
if (settings.store.selfDeafen && !MediaEngineStore.isSelfDeaf() && SelectedChannelStore.getVoiceChannelId()) VoiceActions.toggleSelfDeaf();
}