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
If you wish to enable the chatbot, set these variables
LLM_PROVIDER=
GOOGLE_API_KEY=
OLLAMA_URL=
AGENT_VERBOSE=
LLM_PROVIDER
can beollama
, google
or openai
TODO: Detailed instructions for LLM's
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.
- 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
- AI
- Chatbot
- Multiple LLM support
- Tool usage with Langgraph
- [] Robust memory
- [] Play games with AI
- [] Document in game action payloads
- [] Keep player game statistics
- [] Create REST Api for mafiaggstats
- 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)
Clone the repo
git clone https://github.com/blacksmithop/MafiaggBot
cd MafiaggBot
Install the dependencies
python3 -m pip install -r requirements.txt