Skip to main content

A Python wrapper for the MafiaGG API

Project description

MafiaggBot

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
    • 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 with validator
  • Commands
    • Custom command names
    • Command docs
  • Bot Client
  • Authentication
  • Help command
    • Formatted / multi-message help command
  • Host only commands

Tasklist

  • Don't create new room unless game end
  • Understand role object -> setup code creation
  • Return character info (for decks in next message)
  • Better commands (sub-commands!)
  • Better doc strings using decorators
  • When exiting bot site calls DELETE on user-session (cookie invalidation?)
  • Join other rooms on request
  • Allow for super().__init__ calls

Development

Clone the repo

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

cd MafiaggBot

Install the dependencies

python3 -m pip install -r requirements.txt

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

mafiagg-1.0.2-py3-none-any.whl (84.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page