|
| 1 | +<div align="center"> |
| 2 | + <img src="./Pi.png" alt="" width="256"> |
| 3 | + <br> |
| 4 | + <img alt="GitHub Workflow Status" src="https://img.shields.io/github/workflow/status/yak-fumblepack/pi/Build?style=plastic"> |
| 5 | + <img src="https://img.shields.io/github/license/yak-fumblepack/pi?style=plastic" alt=""> |
| 6 | + <img src="https://img.shields.io/badge/code%20style-black-000000.svg?style=plastic" alt=""> |
| 7 | + <a href="https://discord.com/api/oauth2/authorize?client_id=842500814625832990&permissions=0&scope=bot"><img src="https://img.shields.io/badge/Invite-7289DA?style=plastic&logo=discord&logoColor=white" alt="Invite the bot to your discord server"></a> |
| 8 | +</div> |
| 9 | + |
| 10 | +## Overview |
| 11 | + |
| 12 | +Pi is a discord bot for those interested in contest math to practice their skills while engaging in a casual conversation with their fellow mathematicians or friends. |
| 13 | + |
| 14 | +Some features include: |
| 15 | + |
| 16 | +- Ability to fetch problems from USAMO, USAJMO, AIME, AMC 10 & 12 |
| 17 | +- Fully rendered problems (using LaTeX) with solution links |
| 18 | +- Robust points system to promote healthy competition |
| 19 | +- Extensible core module, simply make a pull request with your cog and we can add it in without a problem! |
| 20 | + |
| 21 | +Note: It would be preferred if you do not host your own instance of this bot |
| 22 | + |
| 23 | +### Table of contents |
| 24 | +- [Getting Started](#getting-started) |
| 25 | +- [Commands](#commands) |
| 26 | +- [Contributing](#contributing) |
| 27 | +- [License](#license) |
| 28 | + |
| 29 | +## Getting Started |
| 30 | + |
| 31 | +### Python venv |
| 32 | + |
| 33 | +Make a virtual environment |
| 34 | + |
| 35 | +```shell |
| 36 | +$ mkdir bot && cd bot |
| 37 | +$ python -m venv venv |
| 38 | +$ source venv/bin/activate |
| 39 | +``` |
| 40 | + |
| 41 | +Clone the repo |
| 42 | + |
| 43 | +```shell |
| 44 | +$ git clone https://github.com/yak-fumblepack/pi.git |
| 45 | +$ cd pi |
| 46 | +$ pip install -U -r requirements.txt |
| 47 | +``` |
| 48 | + |
| 49 | +Add your token to the environmental variable file (`.env`). Make sure you are in the project's root directory. |
| 50 | + |
| 51 | +```shell |
| 52 | +$ echo "token=<your token without spaces and without the arrow brackets>" > .env |
| 53 | +``` |
| 54 | + |
| 55 | +Change directory and run the bot. |
| 56 | + |
| 57 | +```shell |
| 58 | +$ cd bot/src/ |
| 59 | +$ python main.py |
| 60 | +``` |
| 61 | + |
| 62 | +### Docker |
| 63 | + |
| 64 | +Prerequisites: |
| 65 | +- Docker |
| 66 | +- Docker Compose |
| 67 | + |
| 68 | +To run the bot: |
| 69 | + |
| 70 | +```shell |
| 71 | +$ git clone https://github.com/yak-fumblepack/pi.git |
| 72 | +$ sudo docker-compose up --build |
| 73 | +``` |
| 74 | + |
| 75 | +Or if you don't have docker compose, build the image and run it. For more info, refer to their respective readmes: |
| 76 | +- [The bot](https://github.com/yak-fumblepack/pi/tree/rewrite/bot) |
| 77 | + |
| 78 | + |
| 79 | +### Setup |
| 80 | + |
| 81 | +This bot uses firebase as the database service. |
| 82 | + |
| 83 | +Set up the `.env` like so (if you would like to run it using firebase): |
| 84 | + |
| 85 | +``` |
| 86 | +token=<your token> |
| 87 | +bug_channel=<channel id> |
| 88 | +feature_channel=<channel id> |
| 89 | +firebase_type= |
| 90 | +firebase_project_id= |
| 91 | +firebase_private_key_id= |
| 92 | +firebase_private_key= |
| 93 | +firebase_client_email= |
| 94 | +firebase_client_id= |
| 95 | +firebase_auth_uri= |
| 96 | +firebase_token_uri= |
| 97 | +firebase_auth_provider_x509_cert_url= |
| 98 | +firebase_client_x509_cert_url= |
| 99 | +``` |
| 100 | + |
| 101 | +Rememeber to omit the < >. There is no space as well. |
| 102 | + |
| 103 | +## Commands |
| 104 | + |
| 105 | +Prefix: `=` |
| 106 | + |
| 107 | +<u>Basic Commands</u> |
| 108 | +<br> |
| 109 | +| Command | Has Arguments | Arguments | Expected Output | |
| 110 | +| --- | --- | --- | --- | |
| 111 | +| `=hello` | No | | `Hello, World!` | |
| 112 | +| `=help` | Yes | `bot`, `math`, `misc` | An embed showing the arguments you can pass to it to learn more about the other commands | |
| 113 | + |
| 114 | +<u>Bot</u> |
| 115 | +<br> |
| 116 | +| Command | Has Arguments | Arguments | Expected Output | |
| 117 | +| --- | --- | --- | --- | |
| 118 | +| `=invite` | No | | Gives invite links to the support server and for the bot | |
| 119 | +| `=info` | No | | Gives info about this bot and other other techinical information | |
| 120 | + |
| 121 | +<u>Math</u> |
| 122 | +<br> |
| 123 | +| Command | Has Arguments | Arguments | Expected Output | |
| 124 | +| --- | --- | --- | --- | |
| 125 | +| `=statistics` | Yes | `@user`, `user_id` | Gives an embed showing your statistics (if you leave the arguments blank) or someone else's statistics | |
| 126 | +| `=tex` | Yes | `tex statement` | Returns a rendered LaTeX statement | |
| 127 | +| `=amc10` | Yes | `easy`, `medium`, `hard` | Gives an AMC10 problem of the selected difficulty | |
| 128 | +| `=amc12` | Yes | `easy`, `medium`, `hard` | Gives an AMC12 problem of the selected difficulty | |
| 129 | +| `=fetch` | Yes | `contest_name year [contest id, optional] problem_number` | Fetches a problem from the specified path | |
| 130 | +| `=last5` | Yes | `contest_name` | Returns the last 5 questions from a specified contest | |
| 131 | +| `=random` | No | | Returns a random problem | |
| 132 | + |
| 133 | +<u>Miscellaneous</u> |
| 134 | +<br> |
| 135 | +| Command | Has Arguments | Arguments | Expected Output | |
| 136 | +| --- | --- | --- | --- | |
| 137 | +| `=suggest` | Yes | `your message` | Allows you to make a feature suggestion or any suggestion. Needs you to complete a captcha | |
| 138 | +| `=report` | Yes | `your message` | Allows you to make a bug report or any report on an issue. Needs you to complete a captcha | |
| 139 | + |
| 140 | +## Contributing |
| 141 | + |
| 142 | +Features, bugfixes, issues are all greatly appreciated. Please, if you do encounter a bug, report it to us by opening an issue or even better, fix it yourself and make a pull request! |
| 143 | + |
| 144 | +Please open a pull request or an issue on the `dev` branch. |
| 145 | + |
| 146 | +## License |
| 147 | +This project is licensed under the [GNU AGPL-3.0](https://www.gnu.org/licenses/agpl-3.0.txt) license. |
0 commit comments