Example #1
0
                continue

            if not line in symbol:
                last_number = int(line)
            else:
                if line in symbol:
                    mod = line
        return summary
    except IndexError:
        return "Error"

while True:
    data = steam.chat.decode(steam.pool(last_message))

    if data["error"] == "OK":
        for message in data["messages"]:
            message_from = message["steamid_from"]

            message_type = message["type"]

            if message_type == "my_saytext":
                # Input example:
                # 2 + 2
                # 2 * 3 + 4
                # 29 / 3 + 2 + - 1
                message_text = message["text"].split(" ")

                if is_contain(message_text):
                    steam.send_message(message_from,  u"Result: " + str(calculate(message_text)))

        last_message = data["messagelast"]
Example #2
0
# coding=utf8
from example import steam

last_message = steam.decode(steam.log_on())["message"]

while True:
    data = steam.decode(steam.pool(last_message))

    if data["error"] == "OK":
        for message in data["messages"]:
            message_from = message["steamid_from"]
            message_type = message["type"]

            if message_type == "saytext":
                message_text = message["text"]
                steam.send_message(message_from, 'You say: ' + message_text)

        last_message = data["messagelast"]