Skip to content

Instantly share code, notes, and snippets.

@Cam1337
Created April 29, 2010 03:49
Show Gist options
  • Save Cam1337/383102 to your computer and use it in GitHub Desktop.
Save Cam1337/383102 to your computer and use it in GitHub Desktop.
def PrintTerminal(self):
Log = open("/Users/Cam/Git/Python/IRC/logs.txt", "a")
if self.args[1].lower() == "part":
pString="%s has parted %s" % (self.Nick, self.args[2])
elif self.args[1].lower() == "join":
pString="%s has joined %s" % (self.Nick, self.args[2][1:])
elif self.args[1]=="QUIT":
pString="%s has quit - ['%s']" %(self.Nick, " ".join(self.args[2:])[1:])
elif self.args[0]=="PING":
pString="You have been pinged by %s" % self.args[1]
elif len(self.args)>=4:
if self.args[3]==":\001ACTION":
pString="*%s %s*" % (self.Nick, " ".join(self.args[4:]))
elif self.Location==config.NICK:
pString="[Self - %s] <%s> %s" % (self.args[1], self.Nick, " ".join(self.args[3:])[1:])
elif self.CMD in ["%s:"%config.NICK.lower(),"%s,"%config.NICK.lower()]:
pString="->[%s - %s] <%s> %s" % (self.Location, self.args[1], self.Nick, " ".join(self.args[3:])[1:])
else:
pString="[%s - %s] <%s> %s" % (self.Location, self.args[1], self.Nick, " ".join(self.args[3:])[1:])
else:
pString="Server"
print pString
Log.write("%s\n"%pString)
Log.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment