Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sincere Singularities #8

Open
wants to merge 58 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
2715880
Initial commit
Vinyzu Jul 16, 2024
99495f4
Set up
koviubi56 Jul 18, 2024
191a013
Fix pre-commit
koviubi56 Jul 18, 2024
a0756e0
Merge pull request #1 from koviubi56/main
Vinyzu Jul 18, 2024
fa8c3bb
Basic Setup of Disnake
Vinyzu Jul 21, 2024
e786085
Merge pull request #2 from SincereSingularities/vinyzu-dev
Vinyzu Jul 21, 2024
e4e6b1e
Package code and clean up (#3)
koviubi56 Jul 22, 2024
3344b7b
Restaurant Chooser View (#4)
Vinyzu Jul 22, 2024
4bb742c
Restaurant Select Improvements (#5)
Vinyzu Jul 22, 2024
5e6412c
GUI based Orders are almost done. (#8)
Vinyzu Jul 24, 2024
5aa704b
Add `check_similarity` (#7)
koviubi56 Jul 24, 2024
146d931
Implement Content Checks. (#9)
Vinyzu Jul 24, 2024
369c8cb
Add generate_random_avatar_url (#10)
koviubi56 Jul 24, 2024
fbf0341
Order Queue System (#11)
Vinyzu Jul 24, 2024
9f42715
Game Quality of Life Improvements (#12)
Vinyzu Jul 25, 2024
a08ecb2
Add points and buying restaurants (#13)
koviubi56 Jul 25, 2024
e6b31c3
Order Conditions (#14)
Vinyzu Jul 26, 2024
0697bd5
Various Game Improvements (#15)
Vinyzu Jul 26, 2024
425c5e6
Refactoring (#16)
koviubi56 Jul 27, 2024
c50d5e1
Various Quality of Life Improvements (#17)
Vinyzu Jul 27, 2024
f82b672
Add automatic difficulty changing (#18)
koviubi56 Jul 27, 2024
360c2f0
Add condition frequency based on difficulty (#19)
koviubi56 Jul 27, 2024
7a11b7a
Linting: Applied opinionated Black Formatting (#20)
Vinyzu Jul 27, 2024
fdccd62
Save Customer Information reload in Modal (#21)
Vinyzu Jul 27, 2024
0fb9477
Add Customer Id to Order Description (#22)
Vinyzu Jul 28, 2024
402f706
Fix Wording/Spelling Errors (#23)
Vinyzu Jul 28, 2024
805db73
[WIP] New Feature: Add database functionality (#6)
WassCodeur Jul 28, 2024
f9c4dfe
Fix Condition Messages (#24)
Vinyzu Jul 28, 2024
c449cab
Rename Extra Information to Extra Wish
Vinyzu Jul 28, 2024
a068415
Merge pull request #25 from Vinyzu/main
Vinyzu Jul 28, 2024
5a06b42
Various Game Improvements (#28)
Vinyzu Jul 28, 2024
d0cbb74
Add Game Title
Vinyzu Jul 28, 2024
887f927
Merge pull request #29 from Vinyzu/main
Vinyzu Jul 28, 2024
36d72a8
Save Customer Information to fill-in even if wrong OrderID (#30)
Vinyzu Jul 28, 2024
f9a776e
Add introduction
koviubi56 Jul 28, 2024
6d12dca
Merge pull request #31 from koviubi56/main
Vinyzu Jul 28, 2024
fdf5bbf
Rework Coin Buy Menu if you dont have enough coins
Vinyzu Jul 28, 2024
2f01d8f
Merge pull request #32 from Vinyzu/main
Vinyzu Jul 28, 2024
5eba445
Delete fixed TODOs
Vinyzu Jul 28, 2024
269301c
Merge branch 'SincereSingularities:main' into main
Vinyzu Jul 28, 2024
e9801a7
Merge pull request #33 from Vinyzu/main
Vinyzu Jul 28, 2024
2e7f1a8
Add Restaurant Colors
Vinyzu Jul 28, 2024
c50f0fe
Merge branch 'SincereSingularities:main' into main
Vinyzu Jul 28, 2024
e6dbbdc
Merge pull request #34 from Vinyzu/main
Vinyzu Jul 28, 2024
be205e4
ReadMe Presentation/Documentation
Vinyzu Jul 31, 2024
ab83b4b
Merge branch 'SincereSingularities:main' into main
Vinyzu Jul 31, 2024
13cb14a
Fix Formatting/Linting
Vinyzu Jul 31, 2024
d9d6db5
Merge branch 'main' of https://github.com/Vinyzu/SincereSingularities
Vinyzu Jul 31, 2024
c486911
Fix empty line
Vinyzu Jul 31, 2024
3440fa5
Fix trailing whitespace
Vinyzu Jul 31, 2024
3700ac6
Merge pull request #35 from Vinyzu/main
Vinyzu Jul 31, 2024
0416b4d
Improve ReadMe Presentation (#36)
Vinyzu Jul 31, 2024
a2618f6
Add Video Description and Authors Pfp (#37)
Vinyzu Aug 1, 2024
c09328f
Add Preview Images (#38)
Vinyzu Aug 1, 2024
d2a8127
Add Helper Commands Documentation (#39)
Vinyzu Aug 1, 2024
08db560
Fix Order Preview Img URLs
Vinyzu Aug 8, 2024
87f8b30
Merge pull request #40 from Vinyzu/main
FoxFil Aug 8, 2024
34ef151
Add 'sincere-singularities/' from commit '87f8b30ff2f5841511078d843a1…
janine9vn Aug 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions sincere-singularities/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
BOT_TOKEN=

DB_HOST="172.17.0.2"
DB_PORT="27017"
DB_NAME = "bot_db"
35 changes: 35 additions & 0 deletions sincere-singularities/.github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# GitHub Action workflow enforcing our code style.

name: Lint

# Trigger the workflow on both push (to the main repository, on the main branch)
# and pull requests (against the main repository, but from any repo, from any branch).
on:
push:
branches:
- main
pull_request:

# Brand new concurrency setting! This ensures that not more than one run can be triggered for the same commit.
# It is useful for pull requests coming from the main repository since both triggers will match.
concurrency: lint-${{ github.sha }}

jobs:
lint:
runs-on: ubuntu-latest

env:
# The Python version your project uses. Feel free to change this if required.
PYTHON_VERSION: "3.11"

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Python ${{ env.PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- name: Run pre-commit hooks
uses: pre-commit/[email protected]
41 changes: 41 additions & 0 deletions sincere-singularities/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Files generated by the interpreter
__pycache__/
*.py[cod]

# Environment specific
.venv
venv
.env
env

# Unittest reports
.coverage*

# Logs
*.log

# PyEnv version selector
.python-version

# Built objects
*.so
dist/
build/

# Distribution / packaging
*.egg-info/

# IDEs
# PyCharm
.idea/
# VSCode
.vscode/
# MacOS
.DS_Store

# json files for test cases
orders.json
states.json

# MyPy
.mypy_cache/
29 changes: 29 additions & 0 deletions sincere-singularities/.pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Pre-commit configuration.
# See https://github.com/python-discord/code-jam-template/tree/main#pre-commit-run-linting-before-committing

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-json
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.5.2
hooks:
- id: ruff
args: [--fix]
- id: ruff-format

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.1
hooks:
- id: mypy
# args: [--strict] # Put config in pyproject.toml. If it doesn't work, put it here.
Comment on lines +25 to +29
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting your requirements in additional_dependencies will allow mypy to type check usage of imported code.
Looks like it wasn't able to catch some issues in bot.py because it couldn't find the dependencies.
https://github.com/pre-commit/mirrors-mypy?tab=readme-ov-file#using-mypy-with-pre-commit

Suggested change
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.1
hooks:
- id: mypy
# args: [--strict] # Put config in pyproject.toml. If it doesn't work, put it here.
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.1
hooks:
- id: mypy
additional_dependencies:
- disnake~=2.9.2
- python-dotenv~=1.0.1
- dacite~=1.8.1
- pymongo~=4.8.0
- torch~=2.3.1
- sentence-transformers~=3.0.1
- transformers~=4.43.2
- numpy<2
- faker~=26.0.0

33 changes: 33 additions & 0 deletions sincere-singularities/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
MIT License

Copyright (c) 2024 Sincere Singularities

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

---

The Software incorporates code from <https://github.com/python-discord/code-jam-template> which is under the following license:

Copyright 2021 Python Discord

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
178 changes: 178 additions & 0 deletions sincere-singularities/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
# Restaurant Rush: Kitchen Chaos

**Sincere Singularities** Python Discord Summer CodeJam 2024 project.
The technology is **Discord Application**, the theme is **Information Overload**, and our chosen framework
is [Disnake](https://github.com/DisnakeDev/disnake/).

---

Did you ever want to experience the information overload and stress of a phone operator?
Well, then you're at the right place!

We've created the first stressful Discord game, in which you play a phone operator for multiple restaurants.
No matter what dishes, customers, or special orders you have to serve, don't lose focus, or you might get overwhelmed by
the information overload!



## Getting Started
See [Installation](https://github.com/SincereSingularities/SincereSingularities?tab=readme-ov-file#installation) and [Running](#running) for detailed instructions.

1. Python 3.11 is [recommended](https://github.com/DisnakeDev/disnake/pull/1135#issuecomment-1847303628). Python 3.10 - 3.12 will probably work.
2. Setup a [Discord Bot](https://docs.disnake.dev/en/stable/discord.html). See [Discord Bot Installation Guide](#discord-bot-installation-guide).
3. Clone the repository :
```shell
git clone https://github.com/SincereSingularities/SincereSingularities/
cd SincereSingularities
pip install -e .
```
4. Setup and run [MongoDB Community Edition](https://www.mongodb.com/docs/manual/administration/install-community/)
5. Set the `BOT_TOKEN`, `DB_HOST`, `DB_PORT` and `DB_NAME` environment variables using the `.env` file.
6. Run The Game:
```shell
python -m sincere_singularities
```
7. Play!

## Video Presentation
[Video Presentation / Description](https://streamable.com/3rcyc0)


## Installation
<details>
<summary>Detailed Installation Guide ⚙️</summary>

### 1. Requirements:
1. [Python 3.11](https://www.python.org/downloads/release/python-3110/)
2. [MongoDB Community Edition](https://www.mongodb.com/docs/manual/administration/install-community/). See [MongoDB Installation Guide](#mongodb-community-edition-installation-guide)
3. [Discord Bot](https://docs.disnake.dev/en/stable/discord.html). See [Discord Bot SetUp Guide](#discord-bot-installation-guide)
### 2. Download:
Run this command in the directory you want to download it to.
```shell
git clone https://github.com/SincereSingularities/SincereSingularities/
cd SincereSingularities
```
### 3. Install the Game as a package via pip:
```shell
pip install -e .
```
### 4. Setup local environment values:
Create and Edit an .env file (see .env.example)
```
BOT_TOKEN (Your Discord Bot Token)
DB_HOST (The IP address of your MongoDB Server)
DB_PORT (The port of your MongoDB Server)
DB_NAME (Your preferred name for the MongoDB Database, defaults to `bot_db`)
```

</details>

## Running
<details>
<summary>Detailed Running Guide ⚙️</summary>

### 1. Start your [MongoDB Server](https://www.mongodb.com/docs/manual/administration/install-community/). See [MongoDB Installation Guide](#mongodb-community-edition-installation-guide)
### 2. Run the Game:
```shell
python -m sincere_singularities
```
### 3. Start a Game Session in a Text Channel:
```
/start_game
```
</details>

## Gameplay
<details>
<summary>Gameplay Explanation 💡</summary>

1. Choose a text channel.
2. Run the `/start_game` command. That will create a thread.
3. The bot will send the menu. This contains multiple restaurants that you can buy. You already own the first one.
4. You will get orders in the thread as messages. Choose and enter the appropriate restaurant, and select the menu items that the customer requested.
5. Then enter the customer's information which consists of:
- Order ID
- Customer Name
- Customer Address
- Delivery Time
- Extra Wishes
6. Submit the order. You will get points based on the accuracy of the order. With your earned coins you can buy new restaurants.
7. From time to time, you will get Order Conditions. Pay attention to these Conditions when fulfilling a order. They will also disappear after some time.
</details>

## Helper Commands
<details>
<summary>Helper Commands 🔨</summary>

- /clear_threads
</br>
``Clears the Threads in the Text Channel the Command was executed in. Requires the Author to have manage_threads permissions.``
- /clear_webhooks
</br>
``Clears the Webhooks in the Text Channel the Command was executed in. Requires the Author to have manage_webhooks permissions.``
</details>

## Discord Bot Installation Guide
<details>
<summary>Discord Bot Installation Guide 🤖</summary>

Extended from [Disnake Bot Guide](https://docs.disnake.dev/en/stable/discord.html)
1. Create a new [Discord Application](https://discord.com/developers/applications).
2. Navigate to the Bot Tab. You can customize your bot. Reset the bot token and copy the freshly created one.
3. Navigate to the OAuth2 Tab.
1. Under `Scopes`, check `bot` and `applications.commands`.
2. Under `Bot Permissions`, check `Manage Webhooks`, `Send Messages`, `Create Public Threads`, `Send Messages in Threads`, `Manage Messages`, `Manage Threads`,
3. Copy the `Generated URL`
4. Paste the `Generated URL` in your browser and invite the bot to your server.
</details>

## MongoDB Community Edition Installation Guide
<details>
<summary>MongoDB Server Installation Guide 💾</summary>

Extended from [MongoDB Community Edition Installer](https://www.mongodb.com/docs/manual/administration/install-community/)
1. Install on Windows
1. For Installation, follow [Windows Installation Guide](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-windows/#install-mongodb-community-edition)
2. To Run MongoDB, follow [Windows Running Guide](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-windows/#run-mongodb-community-edition-from-the-command-interpreter)
2. Install on MacOS
1. For Installation, follow [MacOS Installation Guide](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-os-x/#install-mongodb-community-edition)
2. To Run MongoDB, follow [MacOS Running Guide](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-os-x/#run-mongodb-community-edition)
3. Install on Ubuntu
1. For Installation, follow [Ubuntu Installation Guide](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/#install-mongodb-community-edition)
2. To Run MongoDB, follow [Ubuntu Running Guide](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-ubuntu/#run-mongodb-community-edition)
4. Install on Debian
1. For Installation, follow [Debian Installation Guide](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-debian/#install-mongodb-community-edition)
2. To Run MongoDB, follow [Debian Running Guide](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-debian/#run-mongodb-community-edition)
5. Install on SUSE
1. For Installation, follow [SUSE Installation Guide](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-suse/#install-mongodb-community-edition)
2. To Run MongoDB, follow [SUSE Running Guide](https://www.mongodb.com/docs/manual/tutorial/install-mongodb-on-suse/#run-mongodb-community-edition)

</details>

## Preview Images
<details>
<summary>Preview Images 📸</summary>

#### Main Menu:
<img src="https://github.com/user-attachments/assets/fbb6ae72-de95-45db-9cc3-a1c8c720d809" width="300">

#### Restaurant Menu:
<img src="https://github.com/user-attachments/assets/292bf979-7644-4385-a47e-f244ff04016e" width="300">

#### Easy Order (Pizzaria):
<img src="https://i.ibb.co/bvCNF5x/IMG-5599.jpg" width="300">

#### Medium Order (Fast Food):
<img src="https://i.ibb.co/ZY1xh8L/IMG-5600.jpg" width="300">

#### Hard Order (Sushi):
<img src="https://i.ibb.co/khxGccr/IMG-5601.jpg" width="300">
</details>

# Credits
This project was created by (in order of contributed LOC):

| [Vinyzu](https://github.com/Vinyzu) | [koviubi1](https://github.com/koviubi56) | [WassCodeur](https://github.com/WassCodeur) | [clucker_m8](https://github.com/clucker-m8) | [FoxFil](https://github.com/foxfil) |
|---------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|
| [<img src="https://github.com/vinyzu.png" alt="vinyzu" title="Vinyzu" width="66">](https://github.com/vinyzu) | [<img src="https://github.com/koviubi56.png" alt="koviubi1" title="koviubi1" width="66">](https://github.com/koviubi56) | [<img src="https://github.com/WassCodeur.png" alt="WassCodeur" title="WassCodeur" width="66">](https://github.com/WassCodeur) | [<img src="https://github.com/clucker-m8.png" alt="clucker_m8" title="clucker_m8" width="66">](https://github.com/clucker-m8) | [<img src="https://github.com/foxfil.png" alt="FoxFil" title="FoxFil" width="66">](https://github.com/foxfil) |
| Game | Game | Database | Order Generation | Restaurant Menus |
Loading