Successfully host a Discord Bot server connected with Convai API
Here we list out the steps to successfully host a discord bot server and update the required details to allow users to effectively communicate with the character created.
The current version has support for only Python language. We are striving to include support for servers in other languages also. Please, reach out to us at support@convai.com if you have any queries on this.
Code Link: Github
Steps:
Visit the link given above and clone the repository in your system, where you want to host the server.
Go to your system and open Terminal
Insert the following commands:
We are now inside the python folder that has the necessary code.
We need to edit the .env file to update it with the required credentials. Open the .env file to edit and enter the necessary details.
With this, we are set to start our server, just run the following command:
Now the bot should be running perfectly. You should see some log like this, that indicates that the bot is up.
Note: Here ConvaiBot is the name that we gave. The name of your bot will appear there in place of ConvaiBot.
And we are done. Your bot is up. Keep it running for it to be able to interact with the users.
If you have some problem with hosting it, do reach out to us at support@convai.com and we will get back to you soon.
Convai is looking into solutions for hosting the server bot for you so that you do not have to go through the whole hassle in the above steps. We will keep on updating the docs as soon as we have some updates.
Create your own Discord Bot to share with people in various servers.
Follow the next set of steps to create your own Discord bot:
Navigate to Discord Developer Portal
Click on New Application
Enter the name of the bot that you want to create. Let's go with ConvaiTracy
Accept the Developer Terms of Service and Developer Policy and click on Create.
Now, you land on the application details page. Upload an app icon and provide a description as you see fit. and click on Save Changes.
Then click on OAuth2 --> URL Generator
Click on the bot checkbox under the Scopes section
Click on the following checkboxes under the various Permissions
General Permissions:
Manage Webhooks
Text Permissions:
All the checkboxes
Voice Permissions:
Connect
Speak
Use Voice Activity
Priority Speaker
Request To Speak
Copy the URL generated below. This will be the shareable invite link for the bot on all servers.
Next click on Bot
Click on Add Bot --> Yes, do it!
Allow the following intents under the Privileged Intents section and click on Save Changes.
Click on Reset Tokens to generate a new token for the bot. Then click on Yes, do it
Copy the generated token to be used later for hosting the bot server.
Now we move on to connecting the Discord bot with a Convai Character and hosting the server.
Successfully host a Discord Bot server connected with Convai API from Replit
Here are the steps listed to run the discord bot server from Replit successfully
Sign up to Replit, then visit the link mentioned above to get to the published Repl.
Once you are on the page, click on Fork Repl.
Click on Fork Repl again from the pop-up notification.
This will create a fork of the code in your account. Once it has been forked successfully, it will open the code in the editor for you.
Go over to Secrets in the bottom left corner of the screen.
Now Add the following credentials. Copy the Keys directly from here to avoid any typos.
Convai API Key Details:
Convai Character ID:
Allowed Channels:
Discord Bot Details:
Note: ALLOWED_CHANNELS restricts the bot to respond to only the channels mentioned in the list. This affects all the servers the bot has been invited to. For new server additions, you need to add the new list of allowed channels to the list. This might also require you to re-run the Repl.
After you have entered the details, it should look something like this
Then click on the Run button at the top to start the bot. Once you have the log, saying the bot has started, you are all done.
Integrating Convai Character with Discord Bot
In this documentation, we list out the steps needed to create your own discord bot and connect that with a Convai Character and host a server for the bot to make it accessible to the users in discord.
Feel free to join our Discord Server and be a part of innovative and passionate developers, while you build your own Convai Character.
Before we move on with hosting a discord bot server, let us first create our own character, to connect the bot to. Please follow the steps in the given page to easily get started with creating a simple character.
Now, that we have a character, let us move on to the next step
Convai is looking into solutions for hosting the server bot for you so that you do not have to go through self-hosting in the above steps. We will update the docs as soon as we have a solution.