diff --git a/icons.tsx b/icons.tsx new file mode 100644 index 0000000..26d432e --- /dev/null +++ b/icons.tsx @@ -0,0 +1,17 @@ +/* + * Vencord, a Discord client mod + * Copyright (c) 2024 Vendicated and contributors + * SPDX-License-Identifier: GPL-3.0-or-later + */ + +export function MemberIcon() { + return ( + + + + ); +} diff --git a/index.tsx b/index.tsx index 37c0b37..2c57d3d 100644 --- a/index.tsx +++ b/index.tsx @@ -7,14 +7,15 @@ import "./style.css"; import { ApplicationCommandInputType, ApplicationCommandOptionType, sendBotMessage } from "@api/Commands"; +import { findGroupChildrenByChildId } from "@api/ContextMenu"; import { getUserSettingLazy } from "@api/UserSettings"; -import { InfoIcon } from "@components/Icons"; import { Devs } from "@utils/constants"; import { getCurrentChannel, getCurrentGuild } from "@utils/discord"; import definePlugin from "@utils/types"; import { Forms, GuildMemberStore, GuildStore, Menu, Parser } from "@webpack/common"; -import { GuildMember } from "discord-types/general"; +import { Guild, GuildMember } from "discord-types/general"; +import { MemberIcon } from "./icons"; import { showInRoleModal } from "./RoleMembersModal"; const DeveloperMode = getUserSettingLazy("appearance", "developerMode")!; @@ -33,7 +34,13 @@ function getMembersInRole(roleId: string, guildId: string) { export default definePlugin({ name: "InRole", description: "Know who is in a role with the role context menu or /inrole command (read plugin info!)", - authors: [Devs.nin0dev], + authors: [ + Devs.nin0dev, + { + name: "Ryfter", + id: 898619112350183445n, + }, + ], dependencies: ["UserSettingsAPI"], start() { // DeveloperMode needs to be enabled for the context menu to be shown @@ -44,9 +51,8 @@ export default definePlugin({ <> {Parser.parse(":warning:")} Limitations If you don't have mod permissions on the server, and that server is large (over 100 members), the plugin may be limited in the following ways: - • Offline members won't be listed - • Up to 100 members will be listed by default. To get more, scroll down in the member list to load more members. - • However, friends will always be shown regardless of their status. + • Up to 100 members will be listed by default for each role. To get more, scroll down in the member list to cache more members. + • However, friends will always be shown. ); }, @@ -70,7 +76,7 @@ export default definePlugin({ return sendBotMessage(ctx.channel.id, { content: "Make sure that you are in a server." }); } const role = args[0].value; - showInRoleModal(getMembersInRole(role, ctx.guild.id), role, ctx.channel.id); + showInRoleModal(ctx.guild.id, role); } } ], @@ -90,9 +96,21 @@ export default definePlugin({ id="vc-view-inrole" label="View Members in Role" action={() => { - showInRoleModal(getMembersInRole(role.id, guild.id), role.id, channel.id); + showInRoleModal(guild.id, role.id); }} - icon={InfoIcon} + icon={MemberIcon} + /> + ); + }, + "guild-header-popout"(children, { guild }: { guild: Guild, onClose(): void; }) { + if (!guild) return; + const group = findGroupChildrenByChildId("privacy", children); + group?.push( + showInRoleModal(guild.id, "0")} /> ); }