logo

scripts

A bunch of scripts, some to be moved to their own repository
commit: adbbbff2d9ffd260307ab3e758286d4ac47c79d5
parent: ffb54d84ec2039a6c1452fc8af71f3d962ec7b6d
Author: lanodan <lanodan.delta@free.fr>
Date:   Sun, 23 Mar 2014 16:43:50 +0100

Correct log system

Diffstat:

MIRCBot/IRCBot.py8++++++--
1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/IRCBot/IRCBot.py b/IRCBot/IRCBot.py @@ -45,6 +45,11 @@ def check_url(url): def printIrc(ircout): irc.send('PRIVMSG '+channel+' :'+ircout+'\n') +def log(line): + log = open('IRCBot.log', 'a') #open the log file + log.write(line+'\n') + log.close() + botnick = 'feyris-nyannyan' server = 'holmes.freenode.net' port = '6667' @@ -55,7 +60,6 @@ passwd = '' load_config() -log = open('IRCBot.log', 'a') #open the log file irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #defines the socket irc.connect((server, int(port))) #connects to the server irc.send('PASS '+ passwd +'\n') @@ -95,7 +99,7 @@ while 1: #puts it in a loop title = get_title(wget) printIrc('Title: '+title) print url+', '+title - log.write(url+', '+title) + log(url+', '+title) except: print 'Invalid url' if text.find(':!source') != -1: