-
-
Notifications
You must be signed in to change notification settings - Fork 0
Module creation, importing and sharing
β οΈ EasyDiscordBotBase should not be used for illegal or immoral purposes. The developers of the EasyDiscordBotBase will take no responsibility for the actions of custom module creators.
To create a module, take the template below, fill in the setName and setDescription and code what you want the bot to do in response into the await interaction.reply( ); section (the Discord.JS documentation may come in handy here). You can add require statements for libraries as needed at the top of the file.
const { SlashCommandBuilder } = require('discord.js')
module.exports = {
data: new SlashCommandBuilder()
.setName('<module name (this is what the / command will be!)>')
.setDescription('<a very short description for the user>'),
async execute (interaction) {
await interaction.reply(
<code here>
);
}
}
βοΈ Remember to add
.setDMPermission(false);to the SlashCommandBuilder if your module should not be used within a DM with the bot!
Save the file as the name of the module, for example, ping.js.
Place this file into your modules folder, stop your bot using npm run stop, run npm run refresh-commands and restart your bot with npm run start.
Check your module is working and doing what you wanted it to do when you run the /<module name> command in a server with your bot.
Congrats, you made a module! π
If you would like to share it with the community, see the Sharing modules with the community section.
β οΈ Always check the code and what other users are saying about a module before you add it your bot. There is always the chance that a module could be malicious in its nature. Check it does what you want it to do, with no funny business!
If you have found a module that you would like to use with your bot, adding it your bot is easy!
Just copy the code into a .js file and drop it into the modules folder of your installation, check its notes (located within the module file) to see if it has any additional requirements, then stop your bot using npm run stop, run npm run refresh-commands and restart your bot with npm run start.
β οΈ Knowingly sharing malicious modules with the community could result in your account getting banned from the repo.
β Any additional requirements (such as additional .js files or jsons) must be stored in the
module-dependencies/<module name>folder for your module.
To share a module with the community, make sure that it has the follwing code entered above module.exports in your modules JS file:
/**
* MODULE NAME: <module name>
* MODULE CREATOR: <discord tag or github username>
* MODULE DESCRIPTION: <a short description of the module and what it does>
*
* ADDITIONAL REQUIREMENT: <any additional requirements to run this module>
*/
Your module MUST contain this information.
Once your module is ready to be shared, simply create a post in the "Share your modules!" section of the GitHub discussions advertising your module! Don't forget to include the raw code for the module itself (we recommend using GitHub Gists to make a public gist and then add the link to your post!) and remember to tell the user about any additional requirements to run the module!
β οΈ There is no warranty included or implied with EasyDiscordBotBase, and the creator will accept no liability for damage or loss. It is assumed that you have some technical competence and the ability to host a Discord bot server. If you require support, please use the Issues tab on GitHub for base support, or the Community Help and Support section in the Discussions tab on GitHub for help with modules.