Discord bots · Discord bot
MafiaBot
A full game of Mafia in a text channel, with secret roles, night actions, votes, and stats.
The bot deals the roles in private messages, then runs the nights and days. At night each player presses a button and gets a private menu for their role: Mafia choose a target, the Doctor protects, the Detective investigates, the Vigilante shoots, the Lookout watches. By day everyone votes with a dropdown. The bot checks for a winner after every phase and keeps per-server settings and player statistics.
Roles: Mafia, Godfather, Doctor, Detective, Vigilante, Lookout, Jester, and Townsperson.
Setup
- Invite the bot. It needs to send messages. The thread permissions are optional and give the Mafia a private place to talk.
- Roles arrive by DM. A player whose DMs are closed gets a private “View my role” button in the channel instead, so nobody has to change their settings.
- Optionally, as an administrator, tune the rules with
/mafiabot settings, including how long a vote lasts. /mafiabot startgame @a @b @c @dor/mafiabot startgame vc.
Good to know
Each night step has a 60 second timer and the day vote has a configurable one, so a player who walks away cannot freeze the game. The settings include a testing toggle that reveals every role at game start; it is labeled as such.
Commands
Anyone can use the first group. The second is for the people who run the server.
For everyone
/mafiabot startgameStart a game in this channel with the players you mention, or type vc to use everyone in your voice channel. Four players minimum.
e.g.
/mafiabot startgame players:@a @b @c @d/mafiabot statsThis server's totals and leaderboards.
e.g.
/mafiabot stats/mafiabot mystatsYour own record on this server.
e.g.
/mafiabot mystats/mafiabot helpThe rules and commands.
e.g.
/mafiabot help
For admins
/mafiabot settingsadminRole ratios, vigilante bullets, vote length, reveal and tally options. Administrators only.
e.g.
/mafiabot settings/mafiabot forceendadminEnd the channel's game and reveal every role. Administrators only.
e.g.
/mafiabot forceend
What it needs
Requiredwithout these the bot cannot do its job
- View ChannelsSees the game channel.
- Send MessagesRuns the game in the channel.
- Embed LinksRole cards and phase posts are embeds.
Optionaleach one switches on an extra part
- Create Private ThreadsOpens a private thread where the Mafia plan each night. Without it, the Mafia are asked to make a group DM instead.
- Send Messages in ThreadsLets the bot talk in that Mafia thread.
- Manage ThreadsLocks the Mafia thread when the game ends, and on some servers is what lets the bot add the Mafia to it.
Reads: Server Members intent, starting a game from a voice channel and matching votes to players uses the member list. These are Discord's privileged intents, already switched on for this bot.