Giter VIP home page Giter VIP logo

Comments (3)

TrueWinter avatar TrueWinter commented on August 17, 2024

Hi,

I'm not sure if it was you or someone else, but someone did email me asking the same question. So I'll just copy my reply to that email to answer your question:

When running the help command, the only commands that are shown are the ones the user running the command has access to. Therefore, normal users do not see system commands when running this command. In the dashboard, the command list shows all commands.

While the bot doesn't have any built-in functionality to support hiding other commands, you are free to add this in if needed. The way I would do it is to add an property (for example, showInDashboard) in the exports.help function for each command and set this to true to show it, or false to hide it.

Let's say you want to hide the createinvite command in the dashboard, you would set the exports.help to something like:

exports.help = {
name: 'createinvite',
category: 'Moderation',
description: 'Creates an invite to the channel it is sent in. Example usage: `createinvite 1 5m` will create a single use invite valid for 5 mintues',
usage: 'createinvite [uses]\ncreateinvite [uses] [time (s/m/h/d)]',
showInDashboard: false
};

You would then add code into dashboard/templates/commands.ejs to detect that showInDashboard is false and then not add it. This should be the easiest part of it all. If you need the command also hidden in the help command (keep in mind that only the commands that a user has access to will be shown to them while running this command), you can repeat this process.

While I am always available for support, keep in mind that I offer the source code of the bot for free and am not obliged to provide support. It is also expected that people that change the bot try to understand the code and add to it before contacting me for additional assistance. Also note that changes to the bot may make support more difficult as I would not know about all of the changes.

from discordbot.

DarkenLM avatar DarkenLM commented on August 17, 2024

Thanks. I'll try to do what you said. And I only asked for help because I never used ejs before, and try to find the error with the method I tryed to use in the command.

from discordbot.

DarkenLM avatar DarkenLM commented on August 17, 2024

I've figured it out. First, I added showInDash: true in exports.conf in every command. Then I went to dashboard/templates/commands.ejs and added (Bold):

const help = {};
bot.commands.forEach((command) => {
const cat = command.help.category;
if (!help.hasOwnProperty(cat)) help[cat] = [];
if (command.conf.showInDash) {
help[cat].push(command);
}
});

And the help command I simpky deleted my method, because I haven't noticed the help command just show the commands the users are able to see with their permLevel.

from discordbot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.