class SEChatBot:
  def __init__(self, site="SE",trigger="!!"):
    self.wrap=SEChatWrapper(site)
    self.watchers=[]
  def login(self, username, password):
    self.wrap.login(username,password)
  def joinRoom(roomno):
    "Join some room"
  def watchCommand(commandname,handler):
    "Watch for a command, handler should take (args,roomnumber) as arguments and return a reply"
  def postMessage(roomno,message):
    "Expose inner postMessage here"
  def _watcher():
    "Use array of watch functions to watch room"
Beispiel #2
0
#requires https://pypi.python.org/pypi/websocket-client/
import json,os,sys,getpass
from ChatExchange.SEChatWrapper import *

#wrap=SEChatWrapper("MSO")
wrap=SEChatWrapper("SE")
wrap.login(sys.argv[2],sys.argv[3])
s="\[[Blaze](https://github.com/Charcoal-SE/Blaze)] %s" % sys.argv[1] 
print s
wrap.sendMessage("11540",s)
#wrap.sendMessage("89",s)
import time
time.sleep(5)
Beispiel #3
0
if("ChatExchangeU" in os.environ):
  username=os.environ["ChatExchangeU"]
else:
  print "Username: "******"ChatExchangeP" in os.environ):
  password=os.environ["ChatExchangeP"]
else:
  password=getpass.getpass("Password: "******"SE")
wrap.login(username,password)
wrapm=SEChatWrapper("MSO")
wrapm.login(username,password)
s="[ [SmokeDetector](https://github.com/Charcoal-SE/SmokeDetector) ] SmokeDetector started"
wrap.sendMessage("11540",s)

def checkifspam(data):
  global lasthost,lastid
  d=json.loads(json.loads(data)["data"])
  s= d["titleEncodedFancy"]
  print time.strftime("%Y-%m-%d %H:%M:%S"),parser.unescape(s).encode("ascii",errors="replace")
  site = d["siteBaseHostAddress"]
  site=site.encode("ascii",errors="replace")
  sys.stdout.flush()
  test=FindSpam.testpost(s,site)
  if (0<len(test)):
Beispiel #4
0
#requires https://pypi.python.org/pypi/websocket-client/
import json, os, sys, getpass
from ChatExchange.SEChatWrapper import *

#wrap=SEChatWrapper("MSO")
wrap = SEChatWrapper("SE")
wrap.login(sys.argv[2], sys.argv[3])
s = "\[[Blaze](https://github.com/Charcoal-SE/Blaze)] %s" % sys.argv[1]
print s
wrap.sendMessage("11540", s)
#wrap.sendMessage("89",s)
import time
time.sleep(5)