Skip to content

Discord Commands

PiggyPiglet edited this page Feb 6, 2021 · 2 revisions

Discord

The bot has quite the few commands, which are split into two categories. Permission based commands, and non permission based (normal) commands.

Permission Commands

While not technically a command, but a little feature, if you forget your prefix or set it to something stupid that breaks the commands, you can reset it by typing @DocDex resetprefix

By default permission based commands are limited to users with the ADMINISTRATOR permission, but this can be changed by the role command.

d;prefix:
This command sets the server's prefix, e.g. d;prefix d>. From there on out, you'd use d> instead of d;.

d;algorithm:
This command sets the searching algorithm which will be used when rquesting from the API instance, although as of right now, it's effectively useless, since there's only one algorithm to choose from.

d;role:
This command allows you to declare whether a particular role can access permission based commands. Usage is d;role <add/remove> <role>. e.g. d;role add 322698583377707008. You can get a role's id by tagging it, and putting a blackslash before the @ e.g. getroleid

d;command:
This command allows you to edit the "rules" for a command. Commands currently have 3 possible rules, "allow", "disallow", and "recommendation". Allow/disallow refers to which channels the command can be used in, and the recommendation is a message which will be sent if a user attempts to use a command in a channel which does not fall into the constraints you set in allow/disallow. By default, any command can be used anywhere. If you add an allow, the command can only be used in those channel(s). If you add a disallow, the command can be used anywhere but the channels you have disallowed.
The usage is d;command <allow/disallow/recommendation> [add/remove] <command> <value>.
For example:

  • d;command allow add help 248724056692621313 - Add 248724056692621313 to help's allowed channel list.
  • d;command allow remove help 248724056692621313 - Remove 248724056692621313 from help's allowed channel list.
  • d;command disallow add help 248724056692621313 - Add 248724056692621313 to help's disallowed channel list.
  • d;command recommendation help This command can only be used in #bot-commands. - Set the recommendation for "help" to "This command can only be used in #bot-commands.".

d;default_javadoc:
This command allows you to set the default javadoc which will be used by searching (jdk by default). e.g. d;default_javadoc spigot.

Normal Commands

d;help
The bot's help command. This will show brief descriptions, and the usage of all the commands in the bot.

d;info:
Just shows some basic information about the bot, along with a description. Currently, it provides a link to the api, github, and discord invite. It also has my name, the amount of servers its in (and user count), and the javadoc count (along with the default javadoc). There's also a version number.

d;docs / d;javadocs:
This command provides a list of all the javadocs which are accessible via the bot.

d; / d;search:
This is the default command, the search command, which allows you to retrieve javadoc information. It's quite a complicated one, with 3 parameters. They're explained below, in the next command.

d;sub_interfaces / d;super_interfaces / d;extensions /
d;implementing_classes / d;all_implementations / d;methods /
d;sub_classes / d;implementations / d;fields:
These are effectively all the same command, they just show a different metadata object. The syntax is identical to the search command, having 3 parameters, which are: [javadoc] [limit/$] <query>. As you can see, the only required parameter is query. The javadoc refers to one of the possible javadoc names, for example jdk, or spigot. In the docs menu, javadocs separated with / mean they're aliases. So for example, with spigot/1.16.4, you could use either 1.16.4 or spigot with the search command, or any of these metadata commands. The limit is a number, which you can use on fuzzy queries. It dictates how many results are returned. By default, the limit is five. Alternatively, you can use the symbol $ for your limit, which will simply return the first result. Here are some examples:

  • d;map#getordefault - returns five suggestions.
  • d;map#getordefault(key, defaultvalue) - returns information on Map#getOrDefault.
  • d;$ map#getordefault - returns information on Map#getOrDefault.
  • d;3 map#getordefault - returns 3 suggestions.
  • d;implementing_classes collection - returns all implementations of java.util.Collection.
  • d;spigot player - returns information on spigot's Player interface.
  • d;spigot playah - returns 5 suggestions, player being the first one.
  • d;spigot 3 playah - returns 3 suggestions, player still being the first one.
  • d;spigot $ playah - returns information on spigot's Player interface.
  • d;spigot material%birch_log - returns information on spigot's Material.BIRCH_LOG

If a javadoc object is too big to be viewed in discord, it'll be trimmed down, or a link will be sent.

Console

If you're self hosting the bot, there's also a few console commands available to you.

help:
This will show a list of all the console commands, along with a very brief description. This command can also be triggered by pressing enter without any other input, or typing a non existent command.

reload:
Reloads the config values from the config into memory.

stop:
Gracefully stops the bot, by shutting down JDA & MySQL, then the actual program.

Console based server commands

The following commands are duplicates of the permission based commands that are usable in discord, except the parameters are offset by an index to the right, and the first parameter should be a server id. Apart from that minor difference, these commands literally use the exact same code.

  • command: Edit rules for a command in a server.
  • default_javadoc: Set a server's default javadoc.
  • role: Modify a rule for a role in a server.
  • algorithm: Set a server's algorithm.
  • prefix: Set a server's prefix.