From 872f87b22dbbe8cbef20ec08160f7a047bd3d065 Mon Sep 17 00:00:00 2001 From: nin0dev Date: Fri, 26 Jul 2024 09:46:04 -0400 Subject: [PATCH] made info better --- index.tsx | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/index.tsx b/index.tsx index 910eef5..41062d2 100644 --- a/index.tsx +++ b/index.tsx @@ -4,10 +4,12 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ -import { ApplicationCommandInputType, ApplicationCommandOptionType } from "@api/Commands"; +import { ApplicationCommandInputType, ApplicationCommandOptionType, sendBotMessage } from "@api/Commands"; import { Devs } from "@utils/constants"; import definePlugin from "@utils/types"; -import { Forms } from "@webpack/common"; +import { Forms, GuildMemberStore, Parser } from "@webpack/common"; + +import { showInRoleModal } from "./modal"; export default definePlugin({ name: "InRole", @@ -16,10 +18,10 @@ export default definePlugin({ settingsAboutComponent: () => { return ( <> - ⚠️ Limitations + {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. + • 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. ); }, @@ -37,8 +39,20 @@ export default definePlugin({ }, ], execute: (args, ctx) => { - console.log(args); - console.log(ctx); + // Guild check + if (!ctx.guild) { + return sendBotMessage(ctx.channel.id, { content: "Make sure that you are in a server." }); + } + const role = args[0].value; + console.log(role); + const members = GuildMemberStore.getMembers(ctx.guild!.id); + const membersInRole = []; + members.forEach(member => { + if (member.roles.includes(role)) { + console.log(member); + } + }); + showInRoleModal(membersInRole, role); } } ]