/Dictionary-Bot

Dictionary bot built on Discord API

Primary LanguagePython

DictionaryBot

This project was created to provide dictionary functionality within Discord servers in the form of an automated bot. Using the WordsAPI and World Clock API, the program web scrapes live JSON data to respond to user commands. For more information about utilizing this bot's features, please see Setup and Commands.

Note: The .env file containing the Discord Token and API Key is not included in repository and must be created by user.

Setup

  1. Download bot.py and timer.py
  2. Follow on-screen instructions at WorldClockAPI to create custom API key
  3. Record your custom API Key
  4. Go to Discord Developer Portal WordsAPI and create a new application/bot
  5. Record the Discord Token that corresponds to your bot
  6. Create a .env file in the same directory as bot.py and timer.py with the following lines:
      DISCORD_TOKEN={your_token}
      API_KEY={your_key}
  1. Invite bot to Discord server
  2. Run bot.py and enjoy your new bot!

Click here for more information regarding bot setup

Commands

  • usage: displays all bot commands
  • def WORD: outputs most common dictionary definition of WORD
  • syn WORD: outputs list of synonyms of WORD
  • rhy WORD SYLLABLES(optional): outputs random rhyme of WORD that has the corresponding SYLLABLES
  • ex WORD: outputs an example of WORD
  • rand: outputs random word

Database

The current Dictionary.db is a sample database that will be populated as the progrma continues to scrape data and will change depending on the bot's usage. In order to optimize bot performance and limit API calls, after 10 differing syn, rhy, or ex commands for each word, the application will only output data from the database, rather than the WordsAPI. Following the 10 commands, no new API calls will be made.

To disable the database, simply remove import database.py from bot.py, along with the remaining database.py methods.

Contact

Created by Aiden Szeto - feel free to contact me!