EMMM (Eeny, meeny, miny, moe) is a Slack Bot that can randomly choose a user in a channel out of all of the members in the channel.
Requires python3
.
- Create a Slack Bot in Slack itself. Choose a
name
and get the bot's APItoken
from the Integrations Section. - Start the virtualenv, install dependencies, export environment variables, and retrieve the bot
ID
usingget_bot_id.py
. - Set the bot ID environment variable, and start up
emmm.py
. - In Slack, invite the bot to any of the channels that you want it available in.
- @ mention the bot with
@emmm
.
See EXAMPLE.md for more details on the scripting part outside of Slack itself.
You need the bot's name
, token
, and id
to connect the bot to the Slack APIs.
The script emmm.py
has all of the bot functionality.
# Using EMMM_Slack_Bot in emmm.py to start up eeny meeny miny moe
emmm = EMMM_Slack_Bot(bot_name=BOT_NAME, bot_id=BOT_ID, bot_token=BOT_TOKEN)
emmm.connect()
emmm.start_bot()
You can optionally pass in a list of bot names during initialization that you don't want to consider during the eeny meeny miny moe process.
# Using EMMM_Slack_Bot in emmm.py to start the bot & not include other bots in responses
emmm = EMMM_Slack_Bot(bot_name=BOT_NAME, bot_id=BOT_ID, bot_token=BOT_TOKEN,
known_bot_names=['botname1', 'botname2', BOT_NAME])
...
While the bot's running in a channel, in Slack you can type @emmm to trigger the bot.
The bot will randomly choose a user out of all of the users in the channel, minus any bots configured to be ignored, and send a message to the channel with the user that was chosen.
Check out my personal site!