Ranking
Original Post
[WIP] Bet Server Hosting Bot
Hi, very early WIP of a bot to (help) host a betting server.

Run in Python 3.6.x. Install the modules required through pip, I explained it in one of my other threads.

Right now all it does is join a server and record the chat, I'm gonna be updating this thread as I go along so please report any bugs if you find them.

python code:
import socket
import hashlib
import time
import threading

while 1:
port = input("Enter room port: ")
try:
port = int(port)
break
except:
pass

un = input("Enter username: ")
pw = input("Enter password: ")

s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

try:
s.connect(("144.76.163.135", port))
except:
print("\nFailed to connect, are you sure you wrote the port correctly?")

pw = hashlib.md5(str(pw).encode()).hexdigest()
data = "mlogin "+str(un) + " " + str(pw) +" 0 0\n"

print("\nConnecting: " + data)

s.send(data.encode())

s.send(b"SPEC\n")

print("Starting to ping the server...\n")

def ping_server():
s.send(b"PING\n")
ping = threading.Timer(15.0, ping_server)
ping.start()

ping = threading.Timer(15.0, ping_server)
ping.start()

data_last = 0
user_nudges = {}
nudgeline = 1

while 1:

data = s.recv(1024)
#print(data.decode())
try:
if not data.decode() == data_last:
if data.decode().startswith("SAY"):
if "<^" in data.decode():
chat_user = str(data.decode()[data.decode().find("<")+4:data.decode().find(">")-3])
chat_msg = str(data.decode()[data.decode().find(">")+2:][:-1])
if not chat_user == un:

print(chat_user, "said", chat_msg)

if chat_msg == "!usenudge":
if chat_user in user_nudges:
print("! Nudged", chat_user, "to", str(nudgeline))
s.send(b"NUDGE", chat_user, str(nudgeline)+"\n")
else:
print("! Did not nudge", chat_user + ": no nudges")
#if chat_msg.startswith("!givenudge "):
#if chat_user in user_nudges:

# else:




data_last = data.decode()
except:
data = ""


Last edited by Surge_old2; Jun 30, 2018 at 10:52 PM.
Can you help provide me with a download for Python, I do not know where to download it tbh, I can never get Python code to work with me, I could pm with you on Discord if you would like to help.