Skip to content

opensouls/emobot-discordbot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EmoBot

This discord repo provides everything you need to create your own EmoBot discord bot

EmoBot is a tech demo that shows how Actions can be used from the SocialAGI project to allow a soul to take action, with the specific action here taken being react with various emojis to messages.

Live demo at socialagi.dev

Under the hood, EmoBot uses the SocialAGI library to create its digital soul through just a few commands.

Discord integration tutorial

First export your OpenAI api key:

export OPENAI_API_KEY=sk_...

Second, create a new discord application at https://discord.com/developers/applications. Make sure to create a fun name, username, and profile image.

You'll need a few environment variables to run the bot

export DISCORD_TOKEN_EMOBOT=...

You can find your discord application's API token here:

Screen Shot 2023-06-10 at 5 28 42 PM

Next, you'll need to decide which channel you're going to deploy the bot to in your server

export DISCORD_DEPLOYMENT_CHANNEL_EMOBOT=...

You can find the channelID by visiting your target discord server/channel inside the web browser

image

Now, you'll need to add the discord bot to your server using the discord URL generator with the appropriate permissions

Screen Shot 2023-05-29 at 10 50 22 PM

At the bottom of this page you'll get a URL

Screen Shot 2023-05-29 at 10 30 02 PM

Copy this url and then add your new application's bot to your target server

Screen Shot 2023-06-10 at 5 30 32 PM

Running the discord bot server locally

Now that your discord bot is in your server, you'll need to install the bot's dependencies

npm install

and run the bot

node bot.js

Now, your bot should be in your server running and you should be able to talk to EmoBot.

Screen Shot 2023-06-10 at 5 31 31 PM

Running the discord bot server on heroku

This repo is intended to be deployed to heroku easily.

You'll need to do the following steps:

heroku login

Then create a heroku git repo

heroku create <desired-git-name>

Now, deploy the bot to heroku

git push heroku main

Now that the bot is deployed, you'll have to configure Heroku. First, go to settings and add the appropriate env

Screen Shot 2023-06-10 at 5 28 42 PM

Lastly, adjust the resources to run the bot. Your resources should look like this:

Screen Shot 2023-05-29 at 10 40 13 PM

Make sure to kill your local discord bot server.

That's it! Now you should be able to talk to EmoBot running from your Heroku instance

Now, your bot should be in your server running and you should be able to talk to EmoBot.

Screen Shot 2023-06-10 at 5 25 13 PM