Planning the future of Botwiki! - Help us bring Botwiki up to date, contribute to our strategy discussion, add bot scripts, and contribute manuals, guides, and tutorials! Almost anything related to bots, particularly those used to edit mediawiki, is welcome.
UNABLE TO EDIT? - We've experienced attacks by spambots lately and now require you to confirm your e-mail before you can edit (go to your preferences, enter an e-mail address, and request a confirmation e-mail, then go to your e-mail and click on the confirmation link). We also require new accounts to make a few edits and wait a few minutes before before you can create a page; however, if this is a problem contact us in #botwiki and we can manually confirm your account. Sorry for the inconvenience.
Python:Rcbot.py
This is a simple IRC recent changes bot that works perfectly on all wikimedia wikis. You can change «print data» with another command to begin scanning the change.
As it is configured now, it will work with en.wikipedia, en.wiktionary and meta.wikimedia; of course you can change these values by changing the variable channels.
######## IRC CONFIGURATION ######## server = 'irc.wikimedia.org' port = 6667 nickname = 'rc' channels = ['en.wikipedia', 'en.wiktionary', 'meta.wikimedia'] ################################### import re regexps = [re.compile(r':.*? PRIVMSG (?P<channel>.*) :\x0314\[\[\x0307(?P<title>.*?)\x0314\]\]\x034 (?P<flags>.*?)\x0310 \x0302http:\/\/.*?\/w\/index\.php\?title=.*?&diff=(?P<diff>[0-9]*)&oldid=(?P<oldid>[0-9]*)(&rcid=(?P<rcid>[0-9]*))?\x03 \x035\*\x03 \x0303(?P<user>.*?)\x03 \x035\*\x03 \(\x02?(?P<diffsize>[+-][0-9]*)\x02?\) \x0310(?P<comment>.*)\x03\r\n'), re.compile(r':.*? PRIVMSG (?P<channel>.*) :\x0314\[\[\x0307(?P<title>.*?)\x0314\]\]\x034 (?P<flags>.*?N)\x0310 \x0302http:\/\/.*?\/w\/index\.php\?title=.*?&rcid=(?P<rcid>[0-9]*)\x03 \x035\*\x03 \x0303(?P<user>.*?)\x03 \x035\*\x03 \(\x02?(?P<diffsize>[+-][0-9]*)\x02?\) \x0310(?P<comment>.*)\x03\r\n'), re.compile(r':.*? PRIVMSG (?P<channel>.*) :\x0314\[\[\x0307(?P<title>.*?)\x0314\]\]\x034 (?P<flags>.*?N)\x0310 \x0302http:\/\/.*?\/wiki/.*?\x03 \x035\*\x03 \x0303(?P<user>.*?)\x03 \x035\*\x03 \(\x02?(?P<diffsize>[+-][0-9]*)\x02?\) \x0310(?P<comment>.*)\x03\r\n'), re.compile(r':.*? People generally need guarantees that they receive good grades when order [http://bestwritingservice.com custom term paper] or purchase custom academic papers. Alas, not every academic writing service is able to give those guarantees. PRIVMSG (?P<channel>.*) :\x0314\[\[\x0307(?P<title>.*?)\x0314\]\]\x034 (?P<flags>.*?)\x0310 \x0302\x03 \x035\*\x03 \x0303(?P<user>.*?)\x03 \x035\*\x03 \x0310(?P<comment>.*)\x03\r\n')] import socket, random def rcbot(): rc = socket.socket(socket.AF_INET, socket.SOCK_STREAM) rc.connect((str(server), int(port))) rc.recv(4096) def identify(): rand = str(random.randint(120, 9999)) nick = '%s%s' %(nickname[0:9-len(rand)], rand) rc.send('NICK %s\r\n' %nick) rc.send('USER %s %s %s :%s\r\n' %(nick, nick, nick, nick)) for channel in channels: if not str(channel)[0] in '&#!+': channel = '#%s' %channel rc.send('JOIN %s\r\n' %channel) return nick nick = identify() while True: try: d = rc.recv(4096) if 'PING' in d: rc.send('PONG ' + d.split()[1] + '\r\n') elif d.endswith('433 * %s :Nickname is already in use.\r\n' %nick): nick = identify() elif d == '': try: rc.send('QUIT\r\n') except socket.error: pass rcbot() return d = d.decode('utf-8', 'replace') for r in regexps: m = r.match(d) if m: data = m.groupdict() print data break except KeyboardInterrupt: rc.send('QUIT\r\n') return if __name__ == '__main__': rcbot()