- Kiyo is an open source Discord Bot under the GNU General Public License v3.0 License.
- Uses the discord.js library.
- OtakuGIFs implementation for anime reactions (kiss, hug, etc.).
Extendable, with a lot of utility classes and functions.
Node.js v16.6.0 or higher required. Download here.
git clone https://github.com/StrawHatHacker/Kiyo-Discord-Bot
cd Kiyo-Discord-Bot/
npm install
cd src/
touch .env
Open .env with your favourite text editor and add this line along with your bot token:
DISCORD_BOT_TOKEN="Your bot token here"
BOT_OWNER_ID="Discord ID here"
DEV_GUILD_ID="Discord ID here"
BOT_ID="Discord ID here"
Can be either DEV
or PRODUCTION
. Use PRODUCTION
to load slash commands for all guilds. Use DEV
to load slash commands faster, only for your development server.
ENVIRONMENT="Environment value here"
node index.js
A command should be a file that exports an object. Properties of that object are:
module.exports = {
name: 'ban',
description: 'Bans a user',
aliases: ['boot'],
syntax: 'ban <member> [reason]',
requiredPermissions: {
user: ['BAN_MEMBERS'],
client: ['BAN_MEMBERS']
},
cooldown: 5000,
async run() {
// code here
}
}
name
: Is the name of the command. It gets matched to user input.
description
: General information about the command.
syntax
: Visual representation of how the command should be structured in order to be executed. Elements wrapped in <> are required, elements wrapped in [] are optional.
requiredPermissions
: user and client properties are arrays of key permissions flags that are needed run a command. In the case of user, the user needs any of the
permissions to be authorized. In the case of client, the bot needs all of the permissions to run the command.
run
: Function to execute when the command is invoked.
Needed for slash commands:
aliases
: Array of strings that can invoke the command.
cooldown
: The cooldown of the command in milliseconds.
selfPopulate
: A function that is run when the bot loads the command (meaning on runtime and everytime you reload commands). Usually used to populate the aliases array, like the reaction command, or create the data property for slash commands(see below).
A command should be a file that exports an object. Properties of that object are:
module.exports = {
name: 'ping',
description: 'Pings the bot',
syntax: 'ping',
requiredPermissions: {
user: [],
client: []
},
slashCommand: true,
cooldown: 5000,
selfPopulate() {
this.data = new SlashCommandBuilder()
.setName(this.name)
.setDescription(this.description);
}
}
name
: Is the name of the slash command.
description
: Short description of the slash command.
syntax
: Visual representation of how the command should be structured in order to be executed. Elements wrapped in <> are required, elements wrapped in [] are optional.
requiredPermissions
: user and client properties are arrays of key permissions flags that are needed run a command. In the case of user, the user needs any of the
permissions to be authorized. In the case of client, the bot needs all of the permissions to run the command.
run
: Function to execute when the command is invoked.
slashCommand
: True or false, signifying if the object is a slash command. Should be true for obvious reasons.
data
: Required information for slash commands. Refer to this article.
cooldown
: The cooldown of the command in milliseconds.
selfPopulate
: A function that is run when the bot loads the command. Usually used to populate the aliases array, like the reaction command's, or create the data property for slash commands.
- Slash commands not working
Make sure the
application.commands
scope is checked when you invite the bot in your guild. - Reloading commands doesn't reflect my changes
The slash command "reloadcommands" only reloads files in the
/src/commands
,/src/interactions
and/src/utils
folders.
You can open pull requests freely 👍