Installing and Configuring Walnutbot - HazilTheNut/walnutbot GitHub Wiki
Installing and Configuring Walnutbot
Walnutbot's .jar executable is made to be portable, which simplifies the installation process. However, there are a few steps you need to take in order to get it up and running. You must do the following to create a Discord bot ran by Walnutbot from scratch:
- Instantiate a new Discord Application and associated bot in the Developer Portal
- Add the new Discord bot to your server
- Supply Walnutbot with the bot's token and run the Walnutbot program.
Creating the Discord Bot
- Log in to your Discord account and head to their Developer Portal.
- In the Developer Portal, click "New Application". In the "General Information" tab, you are able to name the application and give it a description, but these are optional.
- Go the "Bot" tab and click "Add Bot" to make your new Application into a Discord Bot. Underneath the "username" field is where you can find your bot's Token, which is needed to get the client supplied by this project to interface with the Discord Bot you just created. Lastly, you are free to have "Requires Ouath2 Grant" left unchecked, as well as leaving all fields under "Privileged Gateway Intents" unchecked. This bot is not complex enough to require such authorizations.
Adding a Discord Bot to Your Server
- In the Discord Developer Portal, head to the "Oauth2" tab of your application and select the "bot" scope and fill in the following permissions at the minimum (no additional permissions are required):
- View Channels
- Send Messages
- Connect
- Speak
- Picking the "bot" scope and the bot's permissions generates a link for you. Follow that link on your web browser and authorize the bot to the servers you would like (given you have the permission to do so). If you want to add your Discord bot to a server for which you do not have the authorization, contact the server's administrator.
Setting Up Walnutbot
After creating the Discord bot, unpack the .zip and open the file config.ini
. Inside are a number of fields, all of which concern themselves with the baseline configuration for the bot needed when the program starts.
Bot Config
token
The Token of the bot you have created. Paste it into the text here to have the Walnutbot client gain control over the Discord bot. If this token is invalid, the bot will completely fail to function. The bot will not work unless you provide a valid token in this field.
command_char
The string of characters needed to initiate a command for this bot. Note: only Discord users need to insert the command_char
at the start of their messages to run a command. Lines of text sent through the command line, through the UI's console log, or through keybindings do not need to prefix their commands with the command_char
to properly function. command_char
may be of any length, though it is encouraged to keep them short to make the bot easier to use.
accept_bot_messages
A boolean value that when set to true enables the bot to receive messages from other Discord bots as commands. Setting this to false can be useful if messages sent from other Discord bots may potentially cause Walnutbot to accidentally run commands.
Status Message
status_use_default
A boolean value that when set to true overrides status_type
and status_message
with the bot's internal default values.
status_type
The type of activity the bot displays. This value may be PLAYING
, WATCHING
, LISTENING
, or EMPTY
. EMPTY
will display no status.
status_message
The message of the activity. Substrings %help%
will be replaced with the help command prefixed with the command_char
.
status_show_current_song
A boolean value that when set to true enables the bot to override the status message with a status listing the song it is currently playing in the Jukebox.
UI and Input Configuration
use_multitheme_icons
A boolean value that when set to true causes the bot to use a baby-blue-colored set of icons rather than black ones. This setting is intended to be used for OS's that have an inherently darker theme.
enable_global_keybinds
A boolean value that when set to true enables the bot to hook into your PC's native keyboard, allowing global, system-wide keybinds of your computer's keyboard.
Command Line Arguments
Walnutbot is able to take -headless
as a command line argument to run the bot in headless mode. Doing so causes the bot to display no GUI and instead take commands from System.in
. This setting is useful for those running the bot on a remote, headless server. Additionally, polling user input in the form of global keybinds is also disabled while running in headless mode.
Additionally, the bot takes -run <script file>
as a command line argument to run a script when the bot starts up. For example, you could do -run ~~/scripts/connect.txt
to have the bot immediately run through a script that connects it to a channel on your server (provided connect.txt
contains the valid commands that do so).