Git Product home page Git Product logo

discordbot-template's Introduction


『 Changelog 』

arroworange Normal command's prefixes are now case insensitive.

『 Currently Known Bugs 』

  • None

『 Features 』

arrow Custom command handler with ton of handlers included to make ur life easier!
arrow Custom event handler , button handler , selectmenu handler and slashcmds handler too!
arrow Given reload commands with other main dev commands.
arrow Organized layout.
arrow Easily customizable.
arrow Chalk logging.

『 Important Notes 』

froggy_arrow Each new / old slashcommand takes 5s each to be created / updated as to comply with Discord API.

froggy_arrow Recommended NodeJS V16+.

froggy_arrow SlashCommands are auto deployed and you don't have to run any code to create them manually. But you have to run the delete code from discord.js docs manually to delete them.

froggy_arrow Global SlashCommands only update per hour. It is recommended to first make a guild command for testing as guild commands are updated immediately and then make them a global command.

froggy_arrow If you want to change the ready event then remember to use these to get the values.

client.commands.normal.size
client.commands.normal.aliases.size
client.events.size
client.commands.buttons.size
client.commands.menus.size
client.commands.slash.size

『 Setup / Configuration 』

arrow_rainbow Install the required modules in the package.json file using the command npm i.
arrow_rainbow Fill / Edit the contents of config.js
arrow_rainbow run the command npm start
arrow_rainbow Make sure you have read the Important Notes sector.

『 Examples 』

Normal Command

module.exports = {
    name : 'ping', // Name of command
    aliases: ["pp", "e"], // Aliases. Optional
    // Check below for avaliable optional options that can be used here.
    run : async(client, message, args, Discord) => {
    	// Your code here.
    }
}      

Events

Client Event

module.exports = {
	name: 'messageDelete', // Name of event that is executed.
	once: true, // Execute event only once. Default: False.
	run: async(client, message) => { // Your event args.) {
		// Event Code
	},
};

Non Client Event

module.exports = {
	customEvent: true,
	run: async(client) => {
		client.distube.on("error", (message, error) => {
		console.error(error)
            })
		},
};

Button Commands

module.exports = {
    name : 'evalbtn', // Must be same as button's Custom Id
    // Check below for avaliable optional options that can be used he
    run : async(client, interaction, Discord) => {
        interaction.reply("yo")
    }
}     

SelectMenu Commands

module.exports = {
    name : 'fun', // Should be same as Menu Custom Id or The menu options set values.
    // Check below for avaliable optional options that can be used he
    run : async(client, interaction, Discord) => {
    	interaction.reply("e")
    }
}     

SlashCommands

module.exports = {
    name : 'fun', // Name of the slash command.
    guilds: ["GuildID", "GuildID"], // Makes this command a guild command in these guilds. // Optional
    description: "A fun command :)", // Description of slash command. Optional
    type: "CHAT_INPUT", // Type of / command. Optional
    options: [{
      name: 'Are you having fun?',
      description: 'Choose true / false.',
      required: true,
      type: "BOOLEAN",
    }], // Options for / command. Optional
    // Check below for avaliable optional options that can be used he
    run : async(client, interaction, Discord) => {
    	interaction.reply("pog")
    }
}     

『 Avaliable Options for all commands and interactions. 』

ownerOnly: true / false

  • Default: false.
  • When true, The command will only be runnable by the bot owner.

cooldown: Time in ms

  • Default: 0.
  • Sets up a global user cooldown for the command for the provided time limit.

userPermissions: ["SEND_MESSAGES" . . .]

  • Default: None.
  • The user of the command must have all of the provided permissions to be able to run the command. Permission(s) names must be in full capital.

clientPermissions: ["SEND_MESSAGES" . . .]

  • Default: None.
  • The client must have all of the provided permissions to be able to run the command. Permission(s) names must be in full capital.

anyUserPermissions: ["SEND_MESSAGES" . . .]

  • Default: None.
  • The user of the command must any one of the provided permissions to be able to run the command. Permission(s) names must be in full capital.

anyClientPermissions: ["SEND_MESSAGES" . . .]

  • Default: None.
  • The client must any one of the provided permissions to be able to run the command. Permission(s) names must be in full capital.

guildOnly: true / false

  • Default: true.
  • When false, The command will be able to be run in DMs as well.

allowBots: true / false

  • Default: false.
  • When true, Bots will also be able to run the command.

onlyUsers: ["User ID", "User ID" . . .]

  • Default: None
  • Only the provided user IDs will be able to run the command.

requiredRoles: ["Role ID", "Role ID" . . .]

  • Default: None
  • Users will need to have all these role to be able to run the command.

requiredAnyRole: ["Role ID", "Role ID" . . .]

  • Default: None
  • Users will need to have any one of these roles to be able to run the command.

onlyChannels: ["Channel ID", "Channel ID" . . .]

  • Default: None
  • The command will only be able to be run in the provided channels.

onlyGuilds: ["Server ID", "Server ID" . . .]

  • Default: None
  • The command will only be able to be run in the provided guilds.

Return Errors Options

These are a part of the above options. You can choose which option should give the error and which option shouldn't.

returnNoErrors: true / false

  • Default: false
  • When true, None of the errors usually sent by the options above will be sent. Basically it is like having all the options below as false.

returnCooldown: true / false

  • Default: true
  • When false, The error message sent by the cooldown handler will not be sent.

returnOwnerOnly: true / false

  • Default: true
  • When false, The error message sent by the ownerOnly handler will not be sent.

returnUserPermissions: true / false

  • Default: true
  • When false, The error message sent by the userPermissions handler will not be sent.

returnClientPermissions: true / false

  • Default: true
  • When false, The error message sent by the clientPermissions handler will not be sent.

returnAnyUserPermissions: true / false

  • Default: true
  • When false, The error message sent by the anyUserPermissions handler will not be sent.

returnAnyClientPermissions: true / false

  • Default: true
  • When false, The error message sent by the anyClientPermissions handler will not be sent.

returnOnlyUsers: true / false

  • Default: true
  • When false, The error message sent by the onlyUsers handler will not be sent.

returnRequiredRoles: true / false

  • Default: true
  • When false, The error message sent by the requiredRoles handler will not be sent.

returnRequiredAnyRole: true / false

  • Default: true
  • When false, The error message sent by the requiredAnyRole handler will not be sent.

returnOnlyChannels: true / false

  • Default: true
  • When false, The error message sent by the onlyChannels handler will not be sent.

returnOnlyGuilds: true / false

  • Default: true
  • When false, The error message sent by the onlyGuilds handler will not be sent.

『 Contribution 』

If you want to contribute towards this repository then follow these steps.

  • Fork this Repository.
  • Edit your fork and save the changes you want to make.
  • Open the pull request.
  • We will check out the code and if it is fine then your PR will be merged.

discordbot-template's People

Contributors

rilecraft avatar

Watchers

James Cloos avatar

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.