Metadata-Version: 2.1
Name: mafiagg
Version: 1.0.3
Summary: A Python wrapper for the MafiaGG API
Home-page: https://github.com/blacksmithop/MafiaggBot
Author: blacksmithop
License: MIT
Project-URL: Documentation, https://blacksmithop.github.io/MafiaggBot/
Project-URL: Issue tracker, https://github.com/blacksmithop/MafiaggBot/issues
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Utilities
Classifier: Typing :: Typed
Requires-Python: >=3.8.0
Description-Content-Type: text/markdown
Requires-Dist: annotated-types ==0.6.0
Requires-Dist: Babel ==2.14.0
Requires-Dist: beautifulsoup4 ==4.12.2
Requires-Dist: black ==23.12.1
Requires-Dist: certifi ==2023.11.17
Requires-Dist: charset-normalizer ==3.3.2
Requires-Dist: click ==8.1.7
Requires-Dist: colorama ==0.4.6
Requires-Dist: docutils ==0.20.1
Requires-Dist: ghp-import ==2.1.0
Requires-Dist: idna ==3.6
Requires-Dist: importlib-metadata ==7.0.1
Requires-Dist: jaraco.classes ==3.3.0
Requires-Dist: Jinja2 ==3.1.2
Requires-Dist: keyring ==24.3.0
Requires-Dist: Markdown ==3.5.1
Requires-Dist: markdown-it-py ==3.0.0
Requires-Dist: MarkupSafe ==2.1.3
Requires-Dist: mdurl ==0.1.2
Requires-Dist: mergedeep ==1.3.4
Requires-Dist: mkdocs ==1.5.3
Requires-Dist: mkdocs-material ==9.5.3
Requires-Dist: mkdocs-material-extensions ==1.3.1
Requires-Dist: more-itertools ==10.1.0
Requires-Dist: mypy-extensions ==1.0.0
Requires-Dist: nh3 ==0.2.15
Requires-Dist: packaging ==23.2
Requires-Dist: paginate ==0.5.6
Requires-Dist: pathspec ==0.12.1
Requires-Dist: pkginfo ==1.9.6
Requires-Dist: platformdirs ==4.1.0
Requires-Dist: pydantic ==2.5.3
Requires-Dist: pydantic-core ==2.14.6
Requires-Dist: Pygments ==2.17.2
Requires-Dist: pymdown-extensions ==10.7
Requires-Dist: python-dateutil ==2.8.2
Requires-Dist: python-dotenv ==1.0.0
Requires-Dist: pywin32-ctypes ==0.2.2
Requires-Dist: PyYAML ==6.0.1
Requires-Dist: pyyaml-env-tag ==0.1
Requires-Dist: readme-renderer ==42.0
Requires-Dist: regex ==2023.12.25
Requires-Dist: requests ==2.31.0
Requires-Dist: requests-toolbelt ==1.0.0
Requires-Dist: rfc3986 ==2.0.0
Requires-Dist: rich ==13.7.0
Requires-Dist: six ==1.16.0
Requires-Dist: soupsieve ==2.5
Requires-Dist: tomli ==2.0.1
Requires-Dist: twine ==4.0.2
Requires-Dist: typing-extensions ==4.9.0
Requires-Dist: urllib3 ==2.1.0
Requires-Dist: watchdog ==3.0.0
Requires-Dist: websockets ==12.0
Requires-Dist: zipp ==3.17.0
Provides-Extra: docs
Requires-Dist: mkdocs-material ==9.5.3 ; extra == 'docs'

# MafiaggBot

![PyPI - Version](https://img.shields.io/pypi/v/mafiagg)
![Website](https://img.shields.io/website?url=https%3A%2F%2Fblacksmithop.github.io%2FMafiaggBot%2F&up_message=%E2%9C%85&up_color=%E2%9D%8C&logo=github&label=Docs&link=https%3A%2F%2Fblacksmithop.github.io%2FMafiaggBot%2F)


## Usage

---

```shell
pip install -U mafiagg
```


```shell
pip install -U python-dotenv
```

`python-dotenv` lets you pass a `.env` file with your mafia.gg credentials

```
MAFIA_USERNAME=username
MAFIA_PASSWORD=password
```

### Example

```python
from mafiagg.client import Bot
from mafiagg.credential_manager import CredentialManager
from sys import exit


auth = CredentialManager()

bot = Bot(auth=auth, command_prefix="$")

try:
    bot.run()
except KeyboardInterrupt:
    exit(0)
```

> When you run the bot for the first time, it will download some metadata it a `./data/` folder.

---

### Features

- [x] Rooms
  - [x] List rooms
  - [x] Make private/public
  - [x] Become player/spectator
  - [x] Do afk check
    - [x] Do afk check
    - [x] Do ready check
  - [ ] Edit room options
  - [x] Rename room
  - [x] Create new room
    - [x] Only create room when game end
- [x] Decks
  - [x] Get deck by name
  - [x] Set deck by name
  - [x] Use random deck
- [x] Setups
  - [x] Get setup by name
  - [x] Set setup by code
  - [x] Set setup by name
  - [ ] Get current setup code
- [x] Roles
  - [x] Get role by name
  - [x] Cleanup role descriptions, alignment with validator
- [x] Commands
  - [x] Custom command names
  - [x] Command docs
- [x] Bot Client
- [x] Authentication
- [x] Help command
  - [ ] Formatted / multi-message help command
- [x] Host only commands
    - [ ] Host can add admins

### Tasklist

- [ ] Do not allow creation of new room unless game is over
- [ ] Lookup in game Items
- [x] Edit room options
- [ ] Implement conversion of role dictionary to setup codes
- [ ] Return character info (for decks in next message)
- [ ] Better commands (sub-commands!)
- [ ] Better doc strings using decorators
- [ ] Join other rooms on request
- [ ] Allow for `super().__init__` calls
- [ ] Gracefully end session (end event loops, close websocket connection)
    - [ ] When exiting alls DELETE on `user-session` (cookie invalidation)


## Development

Clone the repo

```shell
git clone https://github.com/blacksmithop/MafiaggBot

cd MafiaggBot
```

---

Install the dependencies

```shell
python3 -m pip install -r requirements.txt
```
