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:BotSottile/ops.py
#!/usr/bin/env python """ ops.py - Manage chans Author: FiloSottile@it.wiki About """ import random, re def f_topic(self, origin, match, args): allowchan = False if self.config.access.has_key(self.chan.lower()): allowchan = True allowedchan = self.config.access[self.chan.lower()][1] term = match.group(0) op = False allow = False if allowchan == True: for fi in allowedchan: if origin.nick.lower() == fi.lower(): allow = True for q in self.config.allowed: if origin.nick.lower() == q.lower(): allow = True if allow == True: self.callOP = 'topic' for i in ['', ' ', ' ']: if term == i: op = True if op == True: pass else: self.write(('WHOIS', origin.nick)) self.opdata = self.chan + ' ' + term else: self.notice(origin.nick, "%s: You aren't allowed to do this operation." % origin.nick) f_topic.rule = (['topic'], r"(.*)") def f_invite(self, origin, match, args): allowchan = False if self.config.access.has_key(self.chan.lower()): allowchan = True allowedchan = self.config.access[self.chan.lower()][1] term = match.group(0) op = False allow = False if allowchan == True: for fi in allowedchan: if origin.nick.lower() == fi.lower(): allow = True for q in self.config.allowed: if origin.nick.lower() == q.lower(): allow = True if allow == True: self.callOP = 'invite' for i in ['', ' ', ' ']: if term == i: op = True if op == True: pass else: self.write(('WHOIS', origin.nick)) self.opdata = (self.chan, term) else: self.notice(origin.nick, "%s: You aren't allowed to do this operation." % origin.nick) f_invite.rule = (['invite'], r"(.*)") def f_op(self, origin, match, args): #:ChanServ!ChanServ@services. MODE #wikizionario +o Filnik allowchan = False if self.config.access.has_key(self.chan.lower()): allowchan = True allowedchan = self.config.access[self.chan.lower()][1] term = match.group(3) op = False allow = False if allowchan == True: for fi in allowedchan: if origin.nick.lower() == fi.lower(): allow = True for q in self.config.allowed: if origin.nick.lower() == q.lower(): allow = True if allow == True: self.callOP = 'op' for i in ['', ' ', ' ']: if term == i: op = True if op == True: self.write(('WHOIS', origin.nick)) self.opdata = origin.sender + ' ' + origin.nick else: self.write(('WHOIS', origin.nick)) self.opdata = origin.sender + ' ' + term else: self.notice(origin.nick, "%s: You aren't allowed to do this operation." % origin.nick) f_op.rule = r"(?i)^(\.|\!)op(me)? ?(.*?)$" def f_kick(self, origin, match, args): dest = match.group(2) try: term = match.group(2) + ' ' + match.group(3) except: term = dest allowchan = False if self.config.access.has_key(self.chan.lower()): allowchan = True allowedchan = self.config.access[self.chan.lower()][1] founderchan = self.config.access[self.chan.lower()][0] op = False da = '' allow = False breakme = False self.callOP = 'kick' if origin.nick == self.config.owner: da = 'owner' if allowchan == True: for fi in allowedchan: if origin.nick.lower() == fi.lower(): da = 'allow' if origin.nick.lower() == founderchan: da = 'founder' for q in self.config.allowed: if origin.nick.lower() == q.lower(): da = 'allow' if da == 'owner' or da == 'founder': allow = True elif da == 'allow': allow = True if dest.lower() == self.config.owner.lower() or dest.lower() == self.config.nick.lower(): breakme = True if allowchan == True: if dest.lower() == founderchan.lower(): breakme = True if breakme == False: if allow == True: for i in ['', ' ', ' ']: if term == i: op = True if op == True: self.notice(origin.nick, "%s: You haven't specified who kick" % origin.nick) else: self.write(('WHOIS', origin.nick)) self.opdata = (term, self.chan, origin.nick) else: self.notice(origin.nick, "%s: You aren't allowed to do this operation." % origin.nick) else: self.notice(origin.nick, 'Illegal kick!') f_kick.rule = r"(?i)^(\.|\!)kick? ?([\w\[\]]+) ?([\w ]+)?" def f_ban(self, origin, match, args): dest = match.group(2) term = dest allowchan = False if self.config.access.has_key(self.chan.lower()): allowchan = True allowedchan = self.config.access[self.chan.lower()][1] founderchan = self.config.access[self.chan.lower()][0] op = False da = '' allow = False breakme = False self.callOP = 'ban' if origin.nick == self.config.owner: da = 'owner' if allowchan == True: for fi in allowedchan: if origin.nick.lower() == fi.lower(): da = 'allow' if origin.nick.lower() == founderchan: da = 'founder' for q in self.config.allowed: if origin.nick.lower() == q.lower(): da = 'allow' if da == 'owner' or da == 'founder': allow = True elif da == 'allow': allow = True if dest.lower() == self.config.owner.lower() or dest.lower() == self.config.nick.lower(): breakme = True if allowchan == True: if dest.lower() == founderchan.lower(): breakme = True if breakme == False: if allow == True: for i in ['', ' ', ' ']: if term == i: op = True if op == True: self.notice(origin.nick, "%s: You haven't specified who ban" % origin.nick) else: self.write(('WHOIS', origin.nick)) self.opdata = (self.chan, term) else: self.notice(origin.nick, "%s: You aren't allowed to do this operation." % origin.nick) else: self.notice(origin.nick, 'Illegal kick!') f_ban.rule = r"(?i)^(\.|\!)ban ?([\w\[\]]+)" def f_voice(self, origin, match, args): #/msg ChanServ voice #canale utente term = match.group(3) allowchan = False if self.config.access.has_key(self.chan.lower()): allowchan = True allowedchan = self.config.access[self.chan.lower()][1] op = False allow = False for q in self.config.allowed: if origin.nick.lower() == q.lower(): allow = True if allowchan == True: for fi in allowedchan: if origin.nick.lower() == fi.lower(): allow = True if allow == True: self.callOP = 'voice' for i in ['', ' ', ' ']: if term == i: op = True if op == True: self.write(('WHOIS', origin.nick)) self.opdata = origin.sender + ' ' + origin.nick else: self.write(('WHOIS', origin.nick)) self.opdata = origin.sender + ' ' + term else: self.notice(origin.nick, "%s: You aren't allowed to do this operation." % origin.nick) f_voice.rule = r"(?i)^(\.|\!)voice(me)? ?(.*?)$" def f_devoice(self, origin, match, args): term = match.group(3) allowchan = False if self.config.access.has_key(self.chan.lower()): allowchan = True allowedchan = self.config.access[self.chan.lower()][1] op = False allow = False if allowchan == True: for fi in allowedchan: if origin.nick.lower() == fi.lower(): allow = True for q in self.config.allowed: if origin.nick.lower() == q.lower(): allow = True if allow == True: self.callOP = 'voice' for i in ['', ' ', ' ']: if term == i: op = True if op == True: self.write(('WHOIS', origin.nick)) self.opdata = origin.sender + ' -' + origin.nick else: self.write(('WHOIS', origin.nick)) self.opdata = origin.sender + ' -' + term else: self.notice(origin.nick, "%s: You aren't allowed to do this operation." % origin.nick) f_devoice.rule = r"(?i)^(\.|\!)devoice(me)? ?(.*?)$" #/msg chanserv op #botolatori -Filnik def f_deop(self, origin, match, args): term = match.group(3) allowchan = False if self.config.access.has_key(self.chan.lower()): allowchan = True allowedchan = self.config.access[self.chan.lower()][1] op = False allow = False if allowchan == True: for fi in allowedchan: if origin.nick.lower() == fi.lower(): allow = True for q in self.config.allowed: if origin.nick.lower() == q.lower(): allow = True if allow == True: self.callOP = 'op' for i in ['', ' ', ' ']: if term == i: op = True if op == True: self.write(('WHOIS', origin.nick)) self.opdata = origin.sender + ' -' + origin.nick else: self.write(('WHOIS', origin.nick)) self.opdata = origin.sender + ' -' + term else: self.notice(origin.nick, "%s: You aren't allowed to do this operation." % origin.nick) f_deop.rule = r"(?i)^(\.)deop(me)? ?(.*?)$" def f_exit(self, origin, match, args): allowchan = False if self.config.access.has_key(self.chan.lower()): allowchan = True allowedchan = self.config.access[self.chan.lower()][1] allow = False self.callOP = 'part' if allowchan == True: for fi in allowedchan: if origin.nick.lower() == fi.lower(): allow = True for q in self.config.allowed: if origin.nick.lower() == q.lower(): allow = True if allow == True: self.write(('WHOIS', origin.nick)) self.opdata = origin.sender else: self.notice(origin.nick, "%s: You aren't allowed to do this operation." % origin.nick) f_exit.rule = (['exit'], '.*') #