def get_tap_minter_push(message): if not message.chat.id in caches["push"]: mnemo = db.get_mnemo(message.chat.id) data = json.dumps(dict(seed=mnemo,coin="LIKE")) response = requests.post('https://api.minterpush.com/create', headers={'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzUxMiJ9.eyJpc3MiOiJtaW50ZXJwdXNoLmNvbSIsImF1ZCI6Im1pbnRlcnB1c2guY29tIiwicm9sIjoiYXBpIiwic3ViIjoiUlJQNzRtaDhpb1pDbWh3eWVQMUtUTEJHIiwiZXhwIjoxNTkzMDI5NDcwfQ.poTy3D1fZDcYpLPlRe1pVK6xCiCjbqHL3CNZbpjrMpUEuHDczEz0Q_p4rqQgh0Ia2HYxRQiA-Pn1RWKpJ2Ihkw','Content-Type': 'application/json'}, data=data) caches["push"][message.chat.id] = response.json()["data"]["url"] return caches["push"][message.chat.id]
def like_ddd(client, message): global caches userid = message["from_user"]["id"] add_message_to_cache(message) tg_analytic.statistics_chat(message.chat.id, get_title_chat(message)) value_to_send = int(message.text.split(" ")[1]) if message.reply_to_message.from_user.id != message["from_user"][ "id"] and not message["reply_to_message"]["from_user"][ "is_bot"] and value_to_send > 0: mnemonic = db.get_mnemo(userid) wallet = Wallet(seed=mnemonic) balance = db.get_balance(userid) value_to_send = correct_value_balance(value_to_send, balance) owner = get_owner_chat(app, message) to_address = db.create_user(message.reply_to_message.from_user.id) if value_to_send > 0.01: if owner != None: owner_dat = db.create_user(owner.user.id) # Check if like sending to owner of group or from him if wallet.address == owner_dat[2] or owner_dat[ 2] == to_address[2]: owner = None else: wallet.send(to=owner_dat[2], value=0.1 * float(value_to_send), coin="LIKE", payload='', include_commission=True) if owner == None: transaction = wallet.send(to=to_address[2], value=float(value_to_send), coin="LIKE", payload='', include_commission=True) else: transaction = wallet.send(to=to_address[2], value=0.9 * float(value_to_send), coin="LIKE", payload='', include_commission=True) if transaction != None: # If result success send message to chat if not 'error' in transaction["result"]: a = message["reply_to_message"].reply_text( "Your message was liked by " + get_name(message) + "'s message! [Spend your coins](https://t.me/MinterLikeBot)", parse_mode="Markdown", disable_web_page_preview=True) tg_analytic.statistics(message.chat.id, "emoji like", True, value_to_send) threading.Thread(target=delete_message, args=(a.chat.id, a.message_id)).start()
def like_d(client, message): # For asynchronity because Minter SDK doesnt support asyncio add_message_to_cache(message) tg_analytic.statistics_chat(message.chat.id, get_title_chat(message)) if message.reply_to_message and not "edit_date" is message and message.reply_to_message.from_user.id != message["from_user"]["id"] and not message["reply_to_message"]["from_user"]["is_bot"]: # Get owner chat for sending commision owner_chat = get_owner_chat(app, message) # Get count like for detect how many need send count_emoji = correct_count_emoji(is_emoji(message.text)) value_to_send = correct_value_to_send( 10 ** (count_emoji - 1)) # Correct if count emoji < 1 # Get user from whom will send LIKE user = db.create_user(message["from_user"]["id"]) user_balance = db.get_balance( message["from_user"]["id"]) # Get balance user value_to_send = correct_value_balance( float(value_to_send), float(user_balance)) wallet = Wallet(seed=db.get_mnemo( message["from_user"]["id"])) # Wallet of user to_address = db.create_user( message["reply_to_message"]["from_user"]["id"]) if owner_chat != None: # Check if owner exists owner_dat = db.create_user(owner_chat.user.id) # Check if like sending to owner of group or from him if wallet.address == owner_dat[2] or owner_dat[2] == to_address[2]: owner_chat = None if value_to_send > 0.01: if owner_chat != None: # If owner exists send to him some LIKE wallet.send(to=owner_dat[2], value=0.1 * value_to_send, coin="LIKE", payload='', include_commission=True) transaction = wallet.send(to=to_address[ 2], value=0.9 * value_to_send, coin="LIKE", payload='', include_commission=True) else: transaction = wallet.send(to=to_address[ 2], value=value_to_send, coin="LIKE", payload='', include_commission=True) if transaction != None: # If result success send message to chat if not 'error' in transaction["result"]: tg_analytic.statistics( message.chat.id, "emoji like", True, value_to_send) a = message["reply_to_message"].reply_text("Your message was liked by " + get_name( message) + "! [Spend your coins](https://t.me/MinterLikeBot)", parse_mode="Markdown", disable_web_page_preview=True) threading.Thread(target=delete_message, args=( a.chat.id, a.message_id)).start() # Delete message
def get_tap_mn_push(message): if not message.chat.id in caches["tap_mn"]: caches["tap_mn"][message.chat.id] = requests.post("https://push.minter-scoring.space/api/new",data=dict(seed=db.get_mnemo(message.chat.id))).json()["link"] return caches["tap_mn"][message.chat.id]