Skip to content

NovaProtocol/DisnakeBotTemplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

Disnake Bot Template

This is my own template for making disnake bots. This is not, in any way, the best way to make bots but is the way I am comfortable with.


Installation

Start with installing the required modules by using the following commands.

pip install disnake
pip install python-dotenv

Guide

  1. Start with putting the guild id of your test guild in the test_guilds variable in the file main.py Multiple guild id should work as well.

    test_guilds = [12345678901234, 13771298372174]
  2. By default, it uses all intents as shown in the code. Change this or give the bot the necessary intents.

    intents = disnake.Intents.all()  # all
    intents = disnake.Intents.default()  # all intents that don't require verification
  3. Change the default bot settings. The default is a command bot meaning it acts as an interaction bot and a message bot.

    # Default Interaction bot and Message bot
    bot = commands.Bot(
        command_prefix=commands.when_mentioned,
        intents=intents,
        test_guilds=test_guilds,
        help_command=commands.DefaultHelpCommand(),
    )
    
    # Interaction bot only
    bot = commands.InteractionBot(
        intents=intents,
        test_guilds=test_guilds,
        help_command=commands.DefaultHelpCommand(),
    )
  4. Create a file in the same directory as main.py and name it token.env. It should contain the token of the bot you are using in that format without spaces or quotation marks.

    DISCORD_TOKEN=1234TOKENHERE1234

    After this, the bot should run without any errors after executing main.py from the same directory it is in.


Guide on Cogs

Check out the guide in the cogs folder for a more in depth overview of how to use cogs.