mitochondria
Rauf Dwi Nugroho   Indonesia
 
 
Be a
Mouse and keyboard player.
It's all about passion.
Currently Offline
Last Online 14 days ago
My Custom Bot - (un)Python(ic)
"""
Based on https://github.com/ValvePython/steam
"""
import time
import datetime as dt
import gevent
import json
import re
from bs4 import BeautifulSoup
from steam import SteamClient
from steam.enums.emsg import EMsg
from steam.core.msg import MsgProto
from steam.guard import SteamAuthenticator


class CustomClass(object):
    def __init__(self, *args, **kwargs):
        super(CustomClass, self).__init__(*args, **kwargs)

    def custom_run_forever(self, sec):
        while 1:
            gevent.sleep(sec)

    def post_comment(self, steamid, comment):
        session = self.get_web_session()
        url = "http://steamcommunity.com/comment/Profile/post/{}/-1/" .format(str(steamid))
        data = {"comment": "{}".format(comment), "count": 6, "sessionid": self._web_session_id}
        result = session.post(url, data=data)
        return result.json()

    def fetch_card_data(self):
        session = self.get_web_session()
        url = "http://steamcommunity.com/profiles/steamid64/badges/"
        result = session.get(url)
        return result.text


class MySteamClient(SteamClient, CustomClass):
    pass


client = MySteamClient()
client.set_credential_location(path)

username = "username"
password = "password"
with open('path\secrets.json', 'r') as data: #json file that contains secret and identity keys
    secrets = json.load(data)

sa = SteamAuthenticator(secrets)


@client.on(EMsg.ClientFriendMsgIncoming)
def onMessage(msg):
    messageText = msg.body.message.rstrip().strip("\0")

    if "idle" in messageText:
        while True:
            soup = BeautifulSoup((client.fetch_card_data()), 'html.parser')
            appids = []
            for link in soup.find_all('a'):
                result = isCardAvailable(link.get('href'))
                if result:
                    appids.append(result.group(1))
            if not appids:
                sendMsg = MsgProto(EMsg.ClientFriendMsg)
                sendMsg.body.steamid = msg.body.steamid_from
                sendMsg.body.chat_entry_type = 1
                sendMsg.body.message = "No more games lef to idle."
                sendMsg.body.rtime32_server_timestamp = int(time.time())

                client.send(sendMsg)
                gevent.sleep(2)
                break
            else:
                sendMsg = MsgProto(EMsg.ClientFriendMsg)
                sendMsg.body.steamid = msg.body.steamid_from
                sendMsg.body.chat_entry_type = 1
                sendMsg.body.message = "Starts idling at " + \
                                                    dt.datetime.now().time().strftime("%H:%M:%S")
                sendMsg.body.rtime32_server_timestamp = int(time.time())

                client.games_played(appids)
                client.send(sendMsg)
                gevent.sleep(3600)
                client.disconnect()
                gevent.sleep(2)
                client.relogin()
                gevent.sleep(3)
    elif isCdKey(messageText):
        cdkeyResult = client.register_product_key(messageText)
        sendMsg = MsgProto(EMsg.ClientFriendMsg)
        sendMsg.body.steamid = msg.body.steamid_from
        sendMsg.body.chat_entry_type = 1
        sendMsg.body.message = str(cdkeyResult)
        sendMsg.body.rtime32_server_timestamp = int(time.time())

        client.send(sendMsg)
    elif "rep" in messageText:
        sendMsg = MsgProto(EMsg.ClientFriendMsg)
        sendMsg.body.steamid = msg.body.steamid_from
        sendMsg.body.chat_entry_type = 1
        sendMsg.body.message = "You're welcome"
        sendMsg.body.rtime32_server_timestamp = int(time.time())

        client.post_comment(msg.body.steamid_from, "+ rep :)")
        client.send(sendMsg)
    elif messageText:
        sendMsg = MsgProto(EMsg.ClientFriendMsg)
        sendMsg.body.steamid = msg.body.steamid_from
        sendMsg.body.chat_entry_type = 1
        sendMsg.body.message = "Incorrect command line"
        sendMsg.body.rtime32_server_timestamp = int(time.time())

        client.send(sendMsg)


@client.friends.on(client.friends.EVENT_FRIEND_INVITE)
def handleFriend(friend):
    client.friends.add(friend.steam_id)

@client.on(EMsg.ClientAddFriendResponse)
def welcomeMessage(wel_message):
    greet = MsgProto(EMsg.ClientFriendMsg)
    greet.body.steamid = wel_message.body.steam_id_added
    greet.body.chat_entry_type = 1
    greet.body.message = "Thanks for adding me <3 [Auto generated message]"
    greet.body.rtime32_server_timestamp = int(time.time())

    client.send(greet)


def isCdKey(cdkey):
    cdkey_regex = re.compile(r'^[A-Z0-9]{5}-[A-Z0-9]{5}-[A-Z0-9]{5}$')
    return cdkey_regex.search(cdkey)

def isCardAvailable(card):
    card_regex = re.compile(r'steam://run/([0-9]+)')
    return card_regex.search(card)


if __name__ == "__main__":
    try:
        client.login(username,password,two_factor_code=sa.get_code())
        print "Online"
        client.custom_run_forever(3600)
    except KeyboardInterrupt:
        client.logout()
Workshop Showcase
Adds 4 hairstyles with HDT Physics enabled. Hairstyles meshes are based on SG Hair Pack 268.

Note:
- Physics won't work unless you extract the bsa.

Requirements:
- SKSE
- HDT Physics Extension ( http://www.nexusmods.com/skyrim/mods/53996/? )

Ho
Created by - mitochondria
Sticker Showcase

Recent Activity

11.9 hrs on record
last played on Jun 29
22 hrs on record
last played on Jun 28
Enviador Feb 18, 2015 @ 3:44pm 
trustworthy and fair trader!! recommended +rep
Hyper Jan 2, 2015 @ 6:15pm 
+rep,,, +Fast Respond thx for Premium Minecraft nya
rezamamed Oct 25, 2014 @ 6:34am 
mantap lah agan yg satu ini, bisa dipercaya, klo ada masalah mau refund juga
KP Peter Oct 4, 2014 @ 7:43pm 
Rep ret & Fst Trder !!
aware667 Sep 23, 2014 @ 6:17am 
+rep, a pretty terrific and friendly trader
HerrDanish #NoLongerPlaying Sep 19, 2014 @ 5:05am 
Mantap