Skip to content

darraghd493/DiscordCleverbot

Repository files navigation

Discord Cleverbot

Discord Cleverbot is an unofficial Discord interface for Cleverbot on Discord using node.js and discord.js, allowing you and your friends to chat with Cleverbot on Discord - providing an enjoyable time.

Home page image

Links

Changelog

1.0.0

  • Initial release

2.0.0

  • Add slash commands
  • Improve base and fix bugs
  • Brand new README and weebsite and much more

Installation

Requirements

  • Node.js v16.14.2 or newer
  • Git (recommended - easier to use Git to clone the repository)

Instructions for Windows, Linux and macOS

  1. Clone the repository using git clone
  2. Change directory to the cloned repository using cd
  3. Install the dependencies using npm install
  4. Configure the .env file, see Configuration
  5. Start the bot using npm run start

Instructions for Heroku

Automatic deployment on Heroku "Deploy"

  • Please remember that you will need to configure the .env file, see Configuration
  • Do not create any issues regarding Heroku deployment, as I will not be able to help you unless you have done this yourself

Method 1

This method is untested and may not work.

  1. Create a new app on Heroku
  2. Make sure you have the Heroku CLI installed
  3. Clone the repository using git clone
  4. Change directory to the cloned repository using cd
  5. Login to Heroku using heroku login
  6. Add the Heroku remote using heroku git:remote -a <app name>
  7. Configure the .env file, see Configuration
  8. Commit the changes using git commit -am "Initial commit"
  9. Push the changes to Heroku using git push heroku master
  10. Scale the bot using heroku ps:scale worker=1 (optional)
  11. View the logs using heroku logs --tail

Method 2

This method is untested and may not work.

  1. Create a new app on Heroku
  2. Make a fork of this repository on GitHub
  3. Connect your Github to Heroku and deploy the forked repository
  4. Configure the .env file, see Configuration
  5. Scale the bot using heroku ps:scale worker=1 (optional)
  6. View the logs using heroku logs --tail

Instructions for Repl.it

Automatic deployment on Repl.it "Run on Repl.it"

  1. Create a new repl on Repl.it
  2. Select "Import from GitHub" and paste the repository URL
  3. Go into the secrets tab add the following secrets:
    • token - Your Discord bot token
    • port - The port you want the bot to run on (default: 3000)

Instructions for Glitch

Automatic deployment on Glitch "Remix on Glitch"

  1. Go onto your Glitch dashboard
  2. If it's your first time on Glitch: scroll down to "Import from GitHub" and paste the repository URL. Otherwise click "New Project" and select "Import from GitHub" and enter https://github.com/darraghd493/DiscordCleverbot.git.
  3. Go into the .env file and add the following:
    • token - Your Discord bot token

      Now remove the following:
    • port - The port you want the bot to run on (default: 3000)
  4. Hide the .env file by clicking on "Hide" (recommended - this will hide your bot token from the public)
  5. Go into index.js and remove the app.listener, otherwise you will get an error about the port being in use.6. Open the console and run refresh
  6. Install the dependencies using npm install
  7. Run npm run start in the console

Configuration

Environment variables

The following environment variables are required to run the bot:

Variable Description
TOKEN The Discord bot token.
PORT The port to run the web server on.

You will need to create a new file to do this.

Configuration file

The configuration file is located at config.json and contains the following options:

Option Description Default
activity.switch.enabled Whether to switch the bot's activity. true
activity.switch.delay The interval to switch the bot's activity. 30000
activity.activities The activities to switch between. [{"message":"Cleverbot for a response","type":"Watching"},{"message":"cb.help for help","type":"Playing"},{"message":"with Cleverbot","type":"Playing"},{"message":"with Discord","type":"Playing"}]
activity.activities[].message The message to display. null
activity.activities[].type The type of activity. null
cache.limit The maximum number of messages to cache. 5000
prefix The prefix to use for commands. cb.

Frequently Asked Questions

How do I get a Discord bot token?

  1. Go to the Discord Developer Portal
  2. Click "New Application"
  3. Give the application a name
  4. Click "Bot" on the left
  5. Click "Add Bot"
  6. Click "Copy" under "Token"

How do I invite the bot to my server?

  1. Go to the Discord Developer Portal
  2. Click on your application
  3. Click "OAuth2" on the left
  4. Check the "bot" checkbox
  5. Select the permissions you want the bot to have

How do I get the bot to respond to messages?

The bot will automatically respond to messages once a conversation has been started. To start a conversation, you can either mention the bot or use the start command.

License

This project is licensed under the GNU General Public License v3.0.

Credits

  • Cleverbot - The provider of Cleverbot
  • Discord.js - The Discord API wrapper used for the bot
  • Express - The web server used for the bot

Notes

  • This bot does not use the API, and instead simulates the webpage with cleverbot-free, a package available on npm.
  • Please forgive my mess of tags, I'm just trying to advertise this as it's something I've worked on for quite a while!