-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSoketEvent.py
45 lines (37 loc) · 1.36 KB
/
SoketEvent.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import parsTokens
import socketio
import json
from mcrcon import MCRcon
from LogicParser import ip, password, port, promo, twich_price, price, price_promo
tokens = parsTokens.load_tokens_from_yaml('token.yml')
for token in tokens:
mc = MCRcon(ip, password, port=port)
sio = socketio.Client()
@sio.on('connect')
def on_connect():
sio.emit('add-user', {"token": token, "type": "alert_widget"})
@sio.on('donation')
def on_message(data):
y = json.loads(data)
username = y['username']
amount = y['amount']
currency = y['currency']
message = y['message']
billing = y['billing_system']
if (builtins == 'moneymailru'):
if (message == promo):
if (float(amount) == price_promo):
command = "twl add " + username + "30:d"
return command
elif (float(amount) == price):
command = "twl add " + username + "30:d"
return command
elif (builtins == 'TWITCH'):
if (float(amount) == twich_price):
command = "twl add " + username + "30:d"
return command
mc.connect()
mc.command(on_command())
sio.connect('wss://socket.donationalerts.ru:443', transports='websocket')
while True:
on_connect()