Preparing a Discord Bot for KaiLink
How to Create and Configure a Discord Bot for KaiLink
Before KaiLink can communicate with your Discord server, you'll need to create a Discord bot. This bot acts as the connection between Discord and KaiLink, allowing messages to be received, sent, and processed through the bridge.
Creating a bot is free and only takes a few minutes. You don't need any programming experience.
Step 1: Open the Discord Developer Portal
Visit the Discord Developer Portal.
Sign in using your existing Discord account.
Click New Application in the upper-right corner.
Enter a name for your bot. This is how your bot will be identified on Discord. Discord only allows 2 renames per hour, so try to be sure of the name. The name can be changed through the KaiLink Console later.
Accept Discord's Developer Terms of Service when prompted.
Click Create.
Your new Discord application will open automatically.
Step 2: Configure Your Bot
In the left sidebar, select Bot.
Your application should already have a bot user associated with it. If Discord presents an Add Bot button, click it.
Optionally, upload an avatar.
Find the Public Bot option.
If this bot will only be used on your own Discord server, you can keep Public Bot disabled. This prevents other people from installing it without your authorization.
You do not need to make your bot publicly discoverable to use it with KaiLink, but if you want to use the bot on a server you do not have administrative rights to, it will have to be set public so someone who does have administrative rights can add it.
Step 3: Enable Privileged Gateway Intents
KaiLink needs to receive Discord messages and access their contents. Discord restricts some of this information unless the appropriate intent is enabled.
On the Bot page, scroll down to Privileged Gateway Intents.
Configure the following:
Presence Intent: Disabled
Server Members Intent: Disabled
Message Content Intent: Enabled
Message Content Intent is important. Without it, your bot may connect successfully but be unable to read ordinary messages sent by users in your server.
Only enable Server Members Intent if the functionality you're using specifically requires member events or member lists.
Click Save Changes if Discord displays that option.
Note: Discord may require additional approval for privileged intents when an application grows to a large number of users. Most small private bots can enable the required intent directly.
Step 4: Generate Your Bot Token
Your bot token is a secret credential that allows KaiLink to authenticate with Discord. Do not share this token with anyone.
Stay on the Bot page.
Find the Token section.
Click Reset Token to generate a new token if one is not currently available.
Complete any authentication prompts.
Copy the generated token.
Store it somewhere secure until you're ready to configure KaiLink.
⚠️ Security warning: Never post your bot token in Discord, share it in screenshots, commit it to GitHub, share it with your companion or include it in public documentation.
⚠️ Anyone possessing your token may be able to operate your bot.
If you suspect your token has been exposed, return to the Developer Portal and select Reset Token immediately. The previous token will stop working, and you'll need to update KaiLink with the replacement.
Discord only allows you to view a newly generated token once.
Step 5: Configure Installation Permissions
Your bot needs permission to access the Discord server where you want to use KaiLink.
In the Developer Portal, select Installation from the left sidebar.
Under Installation Contexts, enable Guild Install (server installation).
Under Default Install Settings, configure the Guild Install settings.
Include the bot scope.
Configure the bot permissions listed below.
Recommended Bot Permissions
Required:
View Channels: Allows the bot to see permitted channels
Read Message History: Allows the bot to retrieve previous messages where supported
Send Messages: Allows the bot to post messages
Optional: These settings can be added now at the bot level or at any time later per server by a server admin.
Attach Files: Allows the bot to upload attachments including images
Add Reactions: Allows the bot to react to messages
Embed Links: Allows links with rich previews
Use External Emojis: Optional, for reactions using emojis from other servers
These permissions are a useful starting point for KaiLink's messaging features.
Do not enable Administrator. KaiLink does not need unrestricted control of your Discord server.
Depending on your installation settings, Discord may provide an installation link directly. You can also use the OAuth2 URL Generator with the bot scope and the permissions you've selected.
Step 6: Invite Your Bot to a Discord Server
On the left of the Discord Developer Portal, click OAuth.
Don’t touch any settings at the top here. Go straight down to the OAuth2 URL Generator section.
Select “bot”. This will open a new section below it.
Select the required permissions mentioned in Step 5 and the optional permissions if desired. Remember, these permissions can be modified later by a server administrator on a per server basis, so no need to select all or even any of the optional ones.
Make sure integration type is set to “Guild Install”. Within the developer portal, servers are called “guilds”.
Once you have selected all of your options, copy the installation link generated by Discord at the bottom of the screen.
Open the link in your web browser and select the server you want to add it to. It need to be a server you own or have sufficient administrative rights on. If you do not have the required permissions, give the link to someone on the target server who does.
If you need an administrator to add the bot, you are done with Step 6. The remaining instructions will be handled by them.
Select Add to Server if Discord asks where to install the application.
Choose the Discord server you want to connect.
Review the requested permissions.
Click Authorize.
Complete any verification prompt.
You must have the appropriate permissions to add applications to the selected server.
Once authorized, your new bot should appear in the server's member list.
Your bot may appear offline. This is normal. Creating and inviting a bot does not start the program that operates it. KaiLink will establish the connection when its Discord Bridge is configured and running.
Step 7: Obtain Your Discord Server ID
Some KaiLink configuration workflows may require your Discord server's numerical ID.
To obtain it:
Open Discord.
Click the gear icon beside your username to open User Settings.
Select Advanced.
Enable Developer Mode.
Return to your server list.
Right-click your server's icon.
Select Copy Server ID or Copy ID, depending on your Discord version.
Your server ID is a long sequence of numbers.
Unlike your bot token, your server ID is not a secret authentication credential and is visible by anyone who has access to the server.
Final Security Recommendations
Your bot is an authenticated application with access to portions of your Discord server. Treat it accordingly.
Use only the permissions needed, protect your bot token, and limit channel access wherever practical. Review your bot's permissions periodically, particularly when adding new KaiLink capabilities.
Never share your bot token with other users or your companion. No one needs your token but you. Everyone operating their own KaiLink installation should create and manage their own Discord bot.
Your Discord bot is now ready for KaiLink!