Commit ee385852 authored by Maxime Bombar's avatar Maxime Bombar

Merge branch 'master' of

parents 1bc199bb b9963534
import config
class Bot(
def __init__(self, nickname, channel="#bot", server="", port=6667):, [(server, port)], nickname, nickname)
self.nick = nickname = channel
self.operators = config.operators
def on_nicknameinuse(self, conn, e):
conn.nick(conn.get_nickname() + "_")
self.nick += "_"
def on_welcome(self, conn, e):
self.on_welcome_ext(conn, e)
def on_privmsg(self, conn, e):
if e.source.nick in self.operators:
return self.do_command(conn, e.arguments[0].split(' '), self.operators[e.source.nick], e.source.nick)
return self.do_command(conn, e.arguments[0].split(' '), 0, e.source.nick)
def do_command(self, conn, command, level, source):
if command[0].casefold() == "op":
if len(command) == 2:
dst_level = 100
dst_level = int(command[2])
dst_level = 0
if 0 <= dst_level < level:
self.operators[command[1]] = dst_level
elif command[0].casefold() == "join" and level >= 100:
for channel in command[1:]:
elif command[0].casefold() == "leave" and level >= 100:
for channel in command[1:]:
conn.part(channel, "Ce n'est qu'un au revoir")
self.do_command_ext(conn, command, level, source)
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment