January 10th, 2013, 06:44 PM
Beginner reply bot question
Im trying to make basic irc reply bot and i have question. My reply code looks like this at the moment:
if data.find ( 'bot' ) != -1:
irc.send ( 'PRIVMSG #channel :Yes i am bot\r\n' )
Is it possible to make it not respond if letters "bot" are part of some word like robot or bottle.
January 10th, 2013, 09:04 PM
if "bot" in data.split():
... #do whatever
January 10th, 2013, 09:20 PM
Perhaps something like this is what you need.
pattern = re.compile(r'\w')
for match_object in pattern.finditer(data):
if match_object.string == 'bot':
[/code] are essential for python code and Makefiles!