Skip to main content

MafiaggBot

PyPI - Version Website

Usage


pip install -U mafiagg
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

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

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

Tasklist

  • Do not allow creation of new room unless game is over
  • Lookup in game Items
  • 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
    • Check if bot can handle concurrent games, keep session!
    • Keep role cache based on room id
  • Allow for super().__init__ calls
  • Gracefully end session
    • End event loops, close websocket connection
    • When exiting call DELETE on user-session (cookie invalidation)

Development

Clone the repo

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

cd MafiaggBot

Install the dependencies

python3 -m pip install -r requirements.txt

Metadata

Release files for mafiagg 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mafiagg 1.0.4
File Size Uploaded Provenance
mafiagg-1.0.4.tar.gz 84.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mafiagg 1.0.4
File Interpreter ABI Platform
mafiagg-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 107.6 kB

Release files / mafiagg-1.0.4.tar.gz

Download URL mafiagg-1.0.4.tar.gz
Size 84.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b1e2e846a592bf3804cbe2cadd22004aec3c751d1bbee0602058fff20f0c9d54
BLAKE2b-256 checksum
How to use checksums
84765e568d1997c671334c3a6e7b51625a273934e67a694305f481eb6665420a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Release files / mafiagg-1.0.4-py3-none-any.whl

Download URL mafiagg-1.0.4-py3-none-any.whl
Size 22.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1da94f3933870ef4738b9e736807d983dd3143758d6610cb477d342f9db48420
BLAKE2b-256 checksum
How to use checksums
0b1c4dc84b5e686a8884a38b93a9f1d671e14ef907d2e367a66058ff242ce84c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.0

Security for mafiagg 1.0.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page