Script to retrieve your steemmonsters daily quest Automatically

in #steemmonsters5 years ago (edited)

carbon.png

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.

Sort:  

Cool man! Do you know what to send to change the quest too? (The procedure you can do only once for every quest..)

You just need to replace sm_start_quest with sm_refresh_quest in custom_json id.

Hi, saw you shared this in the room. I have no idea how beem works or python coding, but appreciate you sharing this with the group! :)

I, also, probably won't make use of this myself for lack of understanding of coding but I applaud your initiative and generosity. I'm sure many in the community will appreciate it. Thanks for sharing!

Hi. Why did you take the blocks for that? Not the Time (by UTC)
?

Hmm, we can do that as well

Ai gula ki vai...!

Posted using Partiko Android

Hehe vai eta apner na bujhlew cholbe

Hi, @sourovafrin!

You just got a 0.34% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

LOL... I'm stuck at 'install beem', hahaha
Guess I'll keep doing it manually :0)

😅 Haha. If you have enough free time, you dunt need this

Congratulations @trendo.marketing, 100% upvote has been shared with your successful call on the post that shared by @sourovafrin!


Support @trendotoken projects by delegating : 100SP , 200SP , 500SP , 1000SP , 2000SP

Congratulations @sourovafrin! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You distributed more than 12000 upvotes. Your next target is to reach 13000 upvotes.

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

Vote for @Steemitboard as a witness to get one more award and increased upvotes!

Congratulations @sourovafrin, your post successfully recieved 31.56080963 TRDO from below listed TRENDO callers:

@trendo.marketing earned : 21.04053975 TRDO curation


To view or trade TRDO go to steem-engine.com
Join TRDO Discord Channel or Join TRDO Web Site

Congratulations @trendo.marketing, you are successfuly trended the post that shared by @sourovafrin!
@sourovafrin will receive 31.56080963 TRDO & @trendo.marketing will get 21.04053975 TRDO curation in 3 Days from Post Created Date!

"Call TRDO, Your Comment Worth Something!"

To view or trade TRDO go to steem-engine.com
Join TRDO Discord Channel or Join TRDO Web Site