mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-10 02:09:41 +00:00
- Server will now send adminhelps to the admin channel, with information if there is no admins online. - Server will inform the admin channel if the last admin online logs out. - When a round ends, the server will alert the main channel, supplying some statistics. Additionally, laid the groundwork for an external scripts system. This is fully configurable/togglable in the config.txt file. Signed-off-by: Mloc-Argent <colmohici@gmail.com>
29 lines
730 B
Python
29 lines
730 B
Python
#!/usr/bin/env python2
|
|
|
|
# Two arguments, channel and message.
|
|
# EG: "nudge.py #adminchannel ADMINHELP, people are killing me!"
|
|
|
|
import sys,pickle,socket
|
|
|
|
def pack():
|
|
ip = sys.argv[1]
|
|
try:
|
|
data = sys.argv[2:] #The rest of the arguments is data
|
|
except:
|
|
data = "NO DATA SPECIFIED"
|
|
dictionary = {"ip":ip,"data":data}
|
|
pickled = pickle.dumps(dictionary)
|
|
nudge(pickled)
|
|
def nudge(data):
|
|
HOST = "5.39.81.199"
|
|
PORT = 45678
|
|
size = 1024
|
|
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
|
s.connect((HOST,PORT))
|
|
s.send(data)
|
|
s.close()
|
|
|
|
if __name__ == "__main__" and len(sys.argv) > 1: # If not imported and more than one argument
|
|
pack()
|
|
|