Skip to content

An advanced template for Discord bots with event handling, prefix and slash commands, user app support, and cooldown management.

License

Notifications You must be signed in to change notification settings

RuskyDev/discord-bot-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Bot Template

An advanced template for Discord bots with event handling, prefix and slash commands, user app support, and cooldown management.

Features

  • Easy event handling
  • Works with prefix and slash commands
  • Supports user apps
  • Manages cooldowns efficiently

Templates

Example Slash Command:

const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = {
    data: new SlashCommandBuilder()
        .setName('ping')
        .setDescription('Replies with Pong!')
        .setIntegrationTypes(0, 1) // 0 for Guild Install, 1 for User Install
        .setContexts(0, 1, 2), // 0 for Guild, 1 for Bot DM, 2 for Group Chat        
    cooldown: 5,
    async execute(interaction) {
        await interaction.reply('Pong!');
    },
};

Example Prefix Command:

module.exports = {
    name: 'ping',
    description: 'Replies with Pong!',
    cooldown: 5,
    execute(message, args) {
        message.channel.send('Pong!');
    },
};

Example Event:

module.exports = {
    name: 'messageCreate',
    async execute(message, client) {
        if (message.author.bot) return;

        if (message.content.toLowerCase().includes('israel')) {
            message.reply('Fuck Israel');
        }
    },
};

Example .env File:

TOKEN=
CLIENT_ID=
PREFIX=!

ACTIVITY_NAME=with /help
ACTIVITY_TYPE=PLAYING
ACTIVITY_STATUS=online

Contributions & Bug Reports

If you encounter any bugs, feel free to open an issue or join my Discord server and Contributions are welcome! Be sure to check out the issues tab for ways to help.

About

An advanced template for Discord bots with event handling, prefix and slash commands, user app support, and cooldown management.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project