wikifirc

filter irc.wikimedia.org on specific pages and users
git clone https://a3nm.net/git/wikifirc/
Log | Files | Refs | README

commit 3e5d5c56aa3c4df854fdd7e6d45c59f3bfb94640
parent 8cebb44f1cf3ab1afcf4ebaa4e452bc2237b1cc0
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Mon, 11 Jun 2012 19:26:03 +0200

add primitive command system

Diffstat:
wikifirc | 20+++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/wikifirc b/wikifirc @@ -89,14 +89,20 @@ if __name__ == "__main__": user = fields.pop(0)[1:-1] if user != admin: continue - new_user = ' '.join(fields) - if new_user == 'EXIT': + command = fields[0] + if command == 'exit': break - # register it as a user - for namespace in user_namespaces: - register(pages, namespace + new_user) - # register it as a page - register(pages, new_user) + value = ' '.join(fields[1:]) + if command == "user": + # register it as a user + for namespace in user_namespaces: + register(pages, namespace + new_user) + elif command == "page": + # register it as a page + register(pages, new_user) + else: + # bad command, fail noisily + raise ValueError continue fields.pop(0) # bot username data = ' '.join(fields)