https://github.com/railkill/discord-simp
Simple user-configurable Discord bot that will respond to messages whenever there is a RegEx match.
https://github.com/railkill/discord-simp
Last synced: 11 months ago
JSON representation
Simple user-configurable Discord bot that will respond to messages whenever there is a RegEx match.
- Host: GitHub
- URL: https://github.com/railkill/discord-simp
- Owner: RailKill
- License: mit
- Created: 2021-12-17T12:51:05.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-07-20T15:18:14.000Z (about 3 years ago)
- Last Synced: 2025-05-07T06:16:51.394Z (about 1 year ago)
- Language: Python
- Size: 44.9 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Discord Simple RegEx Message Bot [](https://github.com/RailKill/discord-simp/actions/workflows/ci.yml)
This bot will read messages from any channel it is in, search the message for a RegEx pattern defined in the first column of 'replies.csv',
and replies with the second column of 'replies.csv' if a match is found. It was not designed as a public bot, but pull requests to support
this feature and store responses per server are welcomed.
## Installation
1. Create your Discord bot user and invite it to your server by following this guide: https://discordpy.readthedocs.io/en/stable/discord.html
2. Download and install latest version of [Python](https://www.python.org/downloads/).
3. `git clone` this repository or download zip *(under the green Code button or from Releases page)* and extract it.
4. Open `cmd` and go into the repository folder by typing `cd `
5. Create virtual environment: `python -m venv bot-env`
6. Activate virtual environment: `bot-env\Scripts\activate` on Windows, `bot-env/bin/activate` on Linux.
7. Install dependencies: `pip install -r requirements.txt`
8. Run the bot: `python bot.py` which will generate the config.ini file. It will then exit, telling you
to get your bot's token from https://discord.com/developers/applications.
9. Edit config.ini so that `token = `
10. Repeat step #8.
> **Help! I get gcc build errors when installing the multilib or yarl dependencies!**
>
> Try `MULTILIB_NO_EXTENSIONS=1 YARL_NO_EXTENSIONS=1 pip install -r -requirements.txt`. This issue occurs when multilib and yarl wheel binaries
are not available for your operating system, so these extra flags will disable the compiled speedups and use the slower Python scripts instead.
## replies.csv Example
| RegEx Pattern | Message to Send | Requires Mention? | React with Emoji |
| - | - | - | - |
| \bfries\b | "there is the thin skinless ones, thick skinless, thic with skin, truffle oil, sour scream fries, fries dip on MCD ice cream cone" | 0 | 🍟 |

## Administrator Commands
Type these commands in any text channel the bot is in to execute them. Only works with users having the Administrator role in that channel.
- `!list`
Shows a truncated list of all rows in the .csv file and their indices. The row index is used in add/delete operations.

- `!list `
Shows the full detail of the given row index.

- `!add `
Adds a comma-delimited string as a new row into the .csv file.

The 'row' parameter is entered exactly as how you would type it in the .csv file. In this example, the parameter can be broken
into 4 parts: `\bsomething\b`, `i'm alive!`, `0` and ``. It corresponds to the 4 fields shown in the previous **'replies.csv Example'** section.
- `!reload`
Loads 'replies.csv' without restarting the bot client. This should be done after add or delete.

After reloading, sending a message that matches the `\bsomething\b` regular expression shown in the previous `!add` example will now trigger the bot's response:

- `!delete `
Deletes the given row index from the .csv file.
