logo

scripts

A bunch of scripts, some to be moved to their own repository
commit: 7982066a50ee42882b63f85d4dc6e7bb809f266d
parent: d4793ee434745583a53fa45a7c8ec70b7f4dbd24
Author: lanodan <lanodan.delta@free.fr>
Date:   Thu, 15 May 2014 07:44:56 +0200

Remove Wild space and Update IRCBot

Diffstat:

MIRCBot/IRCBot.py43++++++++++++++++++++++++++++++-------------
Mgmod/hovercraft.e22+-
2 files changed, 31 insertions(+), 14 deletions(-)

diff --git a/IRCBot/IRCBot.py b/IRCBot/IRCBot.py @@ -5,6 +5,8 @@ import socket, sys, re, time, urllib, subprocess, ConfigParser, os +tetris=0 + def get_element(textInput, elem): idx1=textInput.find('<'+elem+'>') idx2=textInput.find('</'+elem+'>') @@ -13,6 +15,7 @@ def get_element(textInput, elem): # Output string into the channel def printIrc(ircout): irc.send('PRIVMSG '+channel+' :'+ircout+'\n') + print '[OUT]'+ircout #line: string of text to add in the log def log(line): @@ -22,16 +25,18 @@ def log(line): log.close() httpRegex = re.compile('https?://+') +userRegex = re.compile(':[\w\d]') config = ConfigParser.ConfigParser() if (config.read('config.ini')): - botnick = config.get('Config', 'nick') - passwd = config.get('Config', 'passwd') - server = config.get('Config', 'server') - port = config.get('Config', 'port') - channel = config.get('Config', 'channel') - quitMsg = config.get('Config', 'quitMessage') - source = config.get('Config', 'source') + botnick = config.get('Config', 'nick') + passwd = config.get('Config', 'passwd') + server = config.get('Config', 'server') + port = config.get('Config', 'port') + channel = config.get('Config', 'channel') + quitMsg = config.get('Config', 'quitMessage') + welcomeMsg = config.get('Config', 'welcomeMessage') + source = config.get('Config', 'source') else: print '[ERROR] Couln\'d load config.ini. Example config file: config.ini.example. Exiting' sys.exit(1) @@ -42,8 +47,8 @@ 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 time.sleep(1) -irc.send('JOIN '+ channel +'\n') #join the chan -printIrc('Ohayo-nyan ! [http://i.imgur.com/vzYFOkp.jpg]') +irc.send('JOIN '+ channel +'\n') +printIrc(welcomeMsg) while 1: #puts it in a loop text=irc.recv(2048) #receive the text @@ -93,12 +98,24 @@ while 1: #puts it in a loop printIrc('[ERROR] Invalid URL') if text.find(':!source') != -1: printIrc(source) - #if text.find(':!'+nick+' help') != -1: - # asker = - #if text.find(' JOIN ') != -1: if text.find('KICK '+channel) != -1: - time.sleep(1) + time.sleep(5) irc.send('JOIN '+ channel +'\n') #join the chan + time.sleep(1) + printIrc(welcomeMsg) + if text.find('tetris') != -1: + if tetris != 1: + printIrc('Never gonna give you up.') + printIrc('Never gonna let you down.') + time.sleep(1) + printIrc('Never gonna run around and desert you.') + printIrc('Never gonna make you cry.') + time.sleep(1) + printIrc('Never gonna say goodbye.') + printIrc('Never gonna tell a lie and hurt you.') + tetris=1 + #if text.find('JOIN '+channel) != -1: + # printIrc('Ohayo-nyan '+str(userRegex.findall((text))+' ! [http://i.imgur.com/vzYFOkp.jpg]') if text.find(':!stop in the name of sey') != -1: irc.send('QUIT : '+quitMsg+'\n') irc.close() diff --git a/gmod/hovercraft.e2 b/gmod/hovercraft.e2 @@ -4,7 +4,7 @@ @persist @trigger -if(Dist <= 50) { //50 is a bout the eyes height +if(Dist <= 50) { //50 is about the eyes height Move = 1 } elseif(Dist >= 60) { //Put a little margin to prevent glitches Move = -1