-
Notifications
You must be signed in to change notification settings - Fork 7
/
systemlog.py
37 lines (36 loc) · 1.52 KB
/
systemlog.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# -*- coding: utf-8 -*-
from colors import *
from ParseConfig import *
import time
import datetime
class Main:
sock = 0
f = 0
def onload(self,tasc):
pass
def oncommandfromserver(self,command,args,socket):
if command == "SAID" and args[0] == "autohost":
self.f.write("[%s] " % (datetime.datetime.fromtimestamp(time.mktime(datetime.datetime.now().timetuple())).ctime()))
self.f.write("<%s> %s\n" % ( args[1] , " ".join(args[2:])))
self.f.flush()
if command == "SAIDEX" and args[0] == "autohost":
self.f.write("[%s] " % (datetime.datetime.fromtimestamp(time.mktime(datetime.datetime.now().timetuple())).ctime()))
self.f.write("* %s %s\n" % ( args[1] , " ".join(args[2:])))
self.f.flush()
if command == "JOINED" and args[0] == "autohost":
self.f.write("[%s] " % (datetime.datetime.fromtimestamp(time.mktime(datetime.datetime.now().timetuple())).ctime()))
self.f.write("** %s has joined the channel\n" % (args[1]))
self.f.flush()
if command == "LEFT" and args[0] == "autohost":
self.f.write("[%s] " % (datetime.datetime.fromtimestamp(time.mktime(datetime.datetime.now().timetuple())).ctime()))
self.f.write("** %s has left the channel ( %s )\n" % ( args[1] , " ".join(args[2:])))
self.f.flush()
def onloggedin(self,socket):
try:
self.f.close()
except:
pass
self.f = open("logs/LOG.txt","a")
self.f.write("[%s] " % (datetime.datetime.fromtimestamp(time.mktime(datetime.datetime.now().timetuple())).ctime()))
self.f.write("********** CONNECTED ***********\n")
self.f.flush()