made info better

This commit is contained in:
nin0dev 2024-07-26 09:46:04 -04:00
parent 9c91386c8d
commit 872f87b22d

View file

@ -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 (
<>
<Forms.FormText style={{ fontSize: "1.2rem", marginTop: "15px", fontWeight: "bold" }}> Limitations</Forms.FormText>
<Forms.FormText style={{ fontSize: "1.2rem", marginTop: "15px", fontWeight: "bold" }}>{Parser.parse(":warning:")} Limitations</Forms.FormText>
<Forms.FormText style={{ marginTop: "10px", fontWeight: "500" }} >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:</Forms.FormText>
<Forms.FormText>- Offline members won't be listed</Forms.FormText>
<Forms.FormText>- Up to 100 members will be listed by default. To get more, scroll down in the member list to load more members.</Forms.FormText>
<Forms.FormText> Offline members won't be listed</Forms.FormText>
<Forms.FormText> Up to 100 members will be listed by default. To get more, scroll down in the member list to load more members.</Forms.FormText>
</>
);
},
@ -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);
}
}
]