
Mike
mike is a Discord bot sends notifications to your discord handle if you get attacked in the @drugwars game. Currently, when somebody attacks you, you have 5-20 minutes of reaction times based on the army of the attacker.
Imagine you're at the office and focusing into your work, and suddenly @ngc attacks you to wipe out your army. The first thing to do is spending in-game resources so they're not exposed for stealing. However, you have still units and you have two options:
- Fight and die
- Send your troops to another easy opponent so they don't die.
In order to react fast to that kind of situations, Mike sends notifications (delay time: 5-10 seconds) to your Discord handle. An instance of the bot is currently live at a new Discord Server free to use for any player.
Usage
After joining the discord server send this command in the #bot-commands
channel:
$subscribe <player_name>
And you're all set. You can subscribe up to 10 different players. If you want to unsubscribe from a player, you can use $unsubscribe <player_name>
and you can see all your subscriptions with $subscriptions
.

Tech talk: Discord bots, Steem and Non blocking I/O
All the data is streamed from the blockchain, almost real-time.
Since discord.py
uses an asyncio eventloop, all functionality of the bot should work with async libraries to avoid blocking calls. The current state of the python libraries for steem is not well in the non-blocking world so using steem-python
, beem
, or lightsteem
was not feasible.
@inertia's amazing meeseeker comes into the play to solve that problem. Since it's possible to subscribe custom jsons with meeseeker, utilizing it helped me remove lots of boilerplate code, and staying in the asyncio loop
without any blocking code. (aioredis
)
If you want to have a private mike for your own joy in your discord server, you can install the bot on your own.
Installation
$ (sudo) pip install drugwars_mike
Configuration and Running
mike
uses meeseeker
to stream custom json operations. If you don't have a meeseker
yet, you need to install it.
An Example command to run meeseker
to have custom json channels:
MEESEEKER_PUBLISH_OP_CUSTOM_ID=true MEESEEKER_EXPIRE_KEYS=300 meeseeker sync
Environment parameters:
Variable | Description | Required |
---|---|---|
MIKE_BOT_TOKEN | Discord bot token | True |
MIKE_BATTLE_LOG_CHANNEL_ID | Channel ID for battle logs | False |
MIKE_DB | Connection URI for DB | True |
MIKE_REDIS_HOST | Redis host | True |
MIKE_REDIS_PORT | Redis port | True |
You can run mike by typing:
$ MIKE_BOT_TOKEN=<token> MIKE_DB=sqlite:///mydatabase.db MIKE_REDIS_HOST=localhost MIKE_REDIS_PORT=6379 mike
Repository and License
Repository is located at github/emre/mike and it's licensed under MIT.
Disclaimer
Even though mike works perfectly at the moment, there is no guarantee that it will notify you every time. Due to potential bugs or lags in the backend blockchain streaming, you may miss some notifications. However, I will be doing my best to keep it always working.
Vote for my witness
This is yet another free of charge tool I have developed for the Steem community. If you like what I do, consider casting a vote on via Steemconnect or on steemit.com