forked from hotio/qbitmanage
-
Notifications
You must be signed in to change notification settings - Fork 0
06. Creating a Discord Bot
engels74 edited this page Oct 19, 2024
·
1 revision
To use TGraph Bot, you need to create a Discord bot and obtain its token. This page will guide you through the process of creating a bot, getting the necessary token, and inviting the bot to your server.
- Go to the Discord Developer Portal.
- Click on the "New Application" button in the top right corner.
- Give your application a name (e.g., "TGraph Bot") and click "Create".
- In your new application, navigate to the "Bot" tab in the left sidebar.
- Click on "Add Bot" and confirm by clicking "Yes, do it!".
- Customize your bot's username if desired.
- In the "Bot" tab, under the "Token" section, click "Copy" to copy your bot token.
- 🔒 IMPORTANT: Keep this token secret! Anyone with this token can control your bot.
- Still in the "Bot" tab, scroll down to the "Bot Permissions" section.
- Select the following permissions:
- Read Messages/View Channels
- Send Messages
- Embed Links
- Attach Files
- Read Message History
- Use Slash Commands
- Go to the "OAuth2" tab in the left sidebar.
- Scroll down to the "Scopes" section and select "bot" and "applications.commands".
- In the "Bot Permissions" section below, select the same permissions as in step 4.
- Copy the generated URL at the bottom of the "Scopes" section.
- Open a new browser tab and paste the URL you copied.
- Select the server you want to add the bot to from the dropdown menu.
- Click "Authorize" and complete any required verification.
Now that you have created your Discord bot, you need to add the bot token to your TGraph Bot configuration:
- Open your
config.yml
file. - Find the
DISCORD_TOKEN
setting. - Replace the placeholder value with your actual bot token:
DISCORD_TOKEN: your_actual_bot_token_here
- Save the
config.yml
file and restart TGraph Bot for the changes to take effect.
- Never share your bot token publicly or commit it to version control systems.
- If you suspect your token has been compromised, go back to the Discord Developer Portal and regenerate it immediately.
- Use environment variables or secure secrets management systems in production environments.
TGraph Bot needs to know which channel to post graphs in. To get your channel ID:
- Enable Developer Mode in Discord (User Settings > Appearance > Advanced > Developer Mode).
- Right-click on the channel you want to use and select "Copy ID".
- Add this ID to your
config.yml
file:CHANNEL_ID: your_channel_id_here
- If your bot doesn't come online, double-check that you've correctly copied the token.
- Ensure the bot has the necessary permissions in your server settings.
- Check the TGraph Bot logs for any error messages related to Discord connectivity.
By following these steps, you should have successfully created a Discord bot and configured TGraph Bot to use it. If you encounter any issues, please refer to the Troubleshooting page or reach out for support.