Script to retrieve your steemmonsters daily quest Automatically
Last night @phattbasskicking was asking if there is an easy and safe script to run and fetch daily quest on Teampossible's discord server. I ownself sometime forget about retrieving my daily quest at routine time. Sometime it's because of my work/study. Then i though why not i create one and share with others.
If you are the one facing the same issue, this post is going to help you out
How to set it up
This is a very simple script using python3.6+.
First you need to install beem (Unofficial Python Library for Steem) in your machine. Then save the following script as filename.py . After saving run the file run it python3 filename.py. This needs to be keep running as it will keep checking whether it's time to fetch the quest or not. You might need a vps server to keep this running. To keep it running on the server user npm or tmux. Alternatively you can use heroku to run this script.
import time
import requests
from beem.steem import Steem
from beem.blockchain import Blockchain
def autoretrieve():
accounts = ["acc1", "acc2"]
stm = Steem(node="https://api.steemit.com", keys=["pass1", "pass2"])
blockchain = Blockchain(steem_instance=stm, mode="head")
for acc in accounts:
link = f"https://steemmonsters.com/players/login?name={acc}"
response = requests.get(link).json()
previous_claim_block = response['quest']['created_block']
current_block = blockchain.get_current_block_num()
if previous_claim_block is not None and current_block >= previous_claim_block + 27600:
try:
json = {"type":"daily","app":"myApp/0.0.1"}
stm.custom_json(id="sm_start_quest", json_data=json, required_posting_auths=[acc])
print(f"Account {acc}: Quest retrieve successful")
except Exception as err:
print(f"Account {acc}: Following error occured- {err}")
if __name__ == '__main__':
print("Auto retrieve quest process is started")
while True:
autoretrieve()
time.sleep(300)
Change you need to do in script
You will have to change credentials of the scripts with your own. Here accounts = ["acc1", "acc2"] take the list of your account username. Change them accordingly.
keys=["pass1", "pass2"] this takes the posting keys of those account. Replace them accordingly. Any mistake will lead to transaction error.
And lastly, time.sleep(300) here the script will sleep for 300 second then again check if it's the time to retrieve the quest. If you want to check more often, you can reduce the time.
You can add account as much as you want. Just don't forget to add the posting key in keys
This script is provided as is and should be used at own risk. If this causes any harm to your account, I cannot be held responsible.