Skip to content

A discord bot written in Python which searches a text file using RegEx to find a quote and print out the line containing the quote as well as the next line in an embed message.

License

Notifications You must be signed in to change notification settings

Bot-Devel/Quote-Finder

Repository files navigation

Quote Finder

MIT license
This is a discord bot written in Python which searches a text file using RegEx to find a quote and output the line containing the quote as well as the next line in an embed message.
The bot currenly supports searching feature for the following fanfiction-

  • Harry Potter and the Prince of Slytherin by The Sinister Man
  • Black Luminary by YakAge
  • Harry Potter and the Ashes of Chaos By ACI100

The bot's command prefix is q

Bot Usage

The bot has the following commands:

  • qf: To search a quote
  • qfk: To search a quote using keywords
  • qhelp: To show the help command


The following is an example on how the bot works in realtime-

Development

Python

  • Install Python >=3.8.5
  • Create a python virtual environment in which you will be installing all the dependencies and activate it before installing the dependencies.
  • Install the dependencies using pip install -r requirements_dev.txt

Git

Forking & Cloning the Quote-Finder Repository

  • Fork the Quote-Finder repository and clone the fork in the Quote Finder directory using git clone --recurse-submodules <URL> since the repository contains a submodule.

  • Create a new branch for your development. Do not add new features to the main branch.

Forking & Cloning the Quote-Finder-Data Repository

  • Since all the data files are stored in a separate Github repository called Quote-Finder-Data, you will need fork & clone it in the Quote Finder directory to add or updates data files.

  • Add or update any files you need to and then push to your fork. Then make a PR to the Upstream

Updating the "data" submodule

  • You will need to pull the submodule once your changes are merged in the Quote-Finder-Data repository.

  • In your Quote-Finder directory, you can simply cd data/ and git pull, as you normally do for repositories since the submodule is also a git repository.

  • Alternatively, you can also use git submodule foreach git pull origin main to pull the changes. This is the recommended way.

Note: This pulls from the Upstream Quote-Finder-Data repository as configured in the .gitmodules file. During development, you can change the url of the submodule to your fork or you can directly copy the files to your local /data directory (recommended).

Discord

  • Create a .env file which should contain the DISCORD_TOKEN for your testing bot as shown in the .env.ex file.

  • Create a testing bot from the Discord Developer Portal and copy the bot token to the .env file.

  • Run the bot using python main.py in the root directory.

  • To add support for other fanfictions, check the scripts/ directory to know how to add the necessary data files.

About

A discord bot written in Python which searches a text file using RegEx to find a quote and print out the line containing the quote as well as the next line in an embed message.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages