logo

scripts

A bunch of scripts, some to be moved to their own repository
commit: eb150c10512cf49f4041f3ef943d04d6a7238159
parent: 5d63e8c5b553543b570145d9e54dd6cfb0a1a10d
Author: lanodan <haelwenn.monnier@gmail.com>
Date:   Tue,  8 Jul 2014 22:40:22 +0200

Change Exception output

Diffstat:

MIRCBot/IRCBot.py13++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/IRCBot/IRCBot.py b/IRCBot/IRCBot.py @@ -45,7 +45,7 @@ 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') irc.send('NICK '+ botnick +'\n') -irc.send('USER '+ botnick +' Feyris NyanNyan :Bot made by lanodan using python!\n') #user authentication +irc.send('USER '+ botnick +' irc bot :Bot made by lanodan using python!\n') #user authentication time.sleep(1) irc.send('JOIN '+ channel +'\n') printIrc(welcomeMsg) @@ -91,12 +91,12 @@ while 1: #puts it in a loop else: printIrc('Type: '+mimeType) log(url+'; '+str(mimeType)) - except: - printIrc('[ERROR] Can\'t open the page') + except Exception, e: + printIrc('Exception: '+str(e)) else: - printIrc('Link too short') - except: - printIrc('[ERROR] Invalid URL') + printIrc('Link too short (not more than 8)') + except Exception, e: + printIrc('Exception: '+str(e)) if text.find(':!source') != -1: printIrc(source) if text.find('KICK '+channel) != -1: @@ -118,7 +118,6 @@ while 1: #puts it in a loop printIrc('Never gonna tell a lie and hurt you.') tetris=1 if text.find(':!stop in the name of sey') != -1: - irc.send('PART : '+quitMsg+'\n') #Hack to prevent Client Quit irc.send('QUIT : '+quitMsg+'\n') irc.close() break