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

Download files

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

Source Distribution

mafiagg-1.0.4.tar.gz (84.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mafiagg-1.0.4-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file mafiagg-1.0.4.tar.gz.

File metadata

  • Download URL: mafiagg-1.0.4.tar.gz
  • Upload date:
  • Size: 84.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for mafiagg-1.0.4.tar.gz
Algorithm Hash digest
SHA256 b1e2e846a592bf3804cbe2cadd22004aec3c751d1bbee0602058fff20f0c9d54
MD5 32ff852ab7011515c84437599354d6c9
BLAKE2b-256 84765e568d1997c671334c3a6e7b51625a273934e67a694305f481eb6665420a

See more details on using hashes here.

File details

Details for the file mafiagg-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: mafiagg-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 22.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.0

File hashes

Hashes for mafiagg-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 1da94f3933870ef4738b9e736807d983dd3143758d6610cb477d342f9db48420
MD5 d25f869d319079e564b3d7a2427e5761
BLAKE2b-256 0b1c4dc84b5e686a8884a38b93a9f1d671e14ef907d2e367a66058ff242ce84c

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 files

1.0.3

2 files

1.0.2

1 file

1.0.1

2 files

1.0.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page