LuckyYam / Chitoge

Just a Fork of Void. Not maintained anymore
GNU Affero General Public License v3.0
81 stars 254 forks source link

Need Help!! #40

Closed AliAryanTech closed 2 years ago

AliAryanTech commented 2 years ago

How to make a command available for admins and mods?? I don't know the syntax 🥲 I tried a lot but facing errors.... Can you tell me?

adminOnly: true || modsOnly: true,

LuckyYam commented 2 years ago
export interface ICommand {
    client?: WAClient;
    handler?: MessageHandler;
    run(
        M: ISimplifiedMessage,
        parsedArgs: IParsedArgs
    ): Promise<void | never> | void | never;
    config: {
        adminOnly?: boolean;
        aliases?: string[];
        description?: string;
        command: string;
        id?: string;
        category?: TCategory;
        usage?: string;
        dm?: boolean;
        baseXp?: number;
        modsOnly?: boolean;
    };
}

You can check it here

AliAryanTech commented 2 years ago

Screenshot_20220324-233107 Just tell me how to make this command available for admins and mods both!! Like if there's a admin but it's not mod then he can use it also if there's a mod but not group admin he can also use that command

LuckyYam commented 2 years ago

Screenshot_20220324-233107 Just tell me how to make this command available for admins and mods both!! Like if there's a admin but it's not mod then he can use it also if there's a mod but not group admin he can also use that command

Unfortunately there isn't a config for that. But you can one like this -

if (!this.client.config.mods.includes(M.sender.jid) && !M.sender.isAdmin) 
      return void M.reply("You can't use this command")

I hope this clears your issue

AliAryanTech commented 2 years ago

Screenshot_20220324-233107 Just tell me how to make this command available for admins and mods both!! Like if there's a admin but it's not mod then he can use it also if there's a mod but not group admin he can also use that command

Unfortunately there isn't a config for that. But you can one like this -

if (!this.client.config.mods.includes(M.sender.jid) && !M.sender.isAdmin) 
      return void M.reply("You can't use this command")

I hope this clears your issue

You didn't tell me where I need to paste it So, it's possible I do a mistake

LuckyYam commented 2 years ago

I think this is what you're looking for

AliAryanTech commented 2 years ago

I think this is what you're looking for

Haha 🙄 Nice, Joke!!

Now tell me where I put that code in This Command