https://github.com/aidenszeto/dictionary-bot
Dictionary bot built on Discord API
https://github.com/aidenszeto/dictionary-bot
Last synced: about 1 month ago
JSON representation
Dictionary bot built on Discord API
- Host: GitHub
- URL: https://github.com/aidenszeto/dictionary-bot
- Owner: aidenszeto
- Created: 2020-07-27T01:28:50.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2020-09-07T23:57:23.000Z (over 4 years ago)
- Last Synced: 2025-02-09T19:56:57.022Z (3 months ago)
- Language: Python
- Homepage:
- Size: 88.9 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DictionaryBot
This project was created to provide dictionary functionality within Discord servers in the form of an automated bot. Using the [WordsAPI](https://www.wordsapi.com/) and [World Clock API](http://worldclockapi.com/), the program web scrapes live JSON data to respond to user commands. For more information about utilizing this bot's features, please see [**Setup**](https://github.com/aidenszeto/DictionaryBot/blob/master/README.md#setup) and [**Commands**](https://github.com/aidenszeto/DictionaryBot/blob/master/README.md#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](http://worldclockapi.com/) to create custom API key
3. Record your custom API Key
4. Go to Discord Developer Portal [WordsAPI](https://discord.com/developers/applications) 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}
```
7. Invite bot to Discord server
8. Run *bot.py* and enjoy your new bot!*Click [here](https://realpython.com/how-to-make-a-discord-bot-python/#how-to-make-a-discord-bot-in-python) 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](https://www.wordsapi.com/). 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](https://www.linkedin.com/in/aidenszeto/) - feel free to contact me!