Files
VOREStation/scripts/ircbot_message.py
Mloc-Argent c4bc5ca06e you saw /nothing/.
Signed-off-by: Mloc-Argent <colmohici@gmail.com>
2013-07-03 12:04:37 +01:00

29 lines
733 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 = "IRCBOT IP HERE"
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()