Wanted the ability to send messages from the command line, so wrote this little script. feel free to add to the project, the time stamp is screwed up, not sure what the fix is.
#!/usr/bin/python2
#
# talk to chat from the command line
# by James Dickens
#
import time
import redis
import sys
redis_host="192.168.1.42"
t = str(time.time()).replace('.','')
count = len(sys.argv)
if count < 3:
print "Usage: "
print sys.argv[0], "username message"
sys.exit()
r = redis.Redis(redis_host)
mess ='{"m":"%s","t":%s,"n":"%s"}'%(sys.argv[2],t,sys.argv[1])
r.publish("chat:messages:latest", mess)
Wanted the ability to send messages from the command line, so wrote this little script. feel free to add to the project, the time stamp is screwed up, not sure what the fix is.