Example #1
0
File: bot.py Project: s0lder/pibot
 def first_write(self, poller, sock):
     self.logger.info("Sending initial info")
     self.send_message(irc.nick(self.conf.get_value("bot.nick")))
     self.send_message(irc.user(self.conf.get_value("bot.nick"),
             self.conf.get_value("bot.realname")))
     self.poller.remove_write(self.sock)
     self.poller.add_write(self.sock, self.write_socket)
     self.plugin_manager.handle_event(events.POST_CONNECT, [])
Example #2
0
def init_connection(request):
    conf = request.source_settings

    username = conf.get('username')
    usermode = conf.get('usermode', 8)
    real_name = conf.get('real_name')
    password = conf.get('password')
    nick = conf.get('nick')

    commands = [irc.user(username, usermode, real_name), irc.nick(nick)]
    if password:
        commands.append(irc.password(password))

    return commands
Example #3
0
def irc_handshake(sock, nick, chan):
	# Stage 0: define what we're looking for in the transactions
	ident_trigger = "Checking Ident"
	join_trigger = "MODE"
	# Stage 1: send our ident once the server requests it
	while True:
		msg = receive(sock)
		if ident_trigger in msg:
			user_cmd = irc.user()		# Formulate USER command
			transmit(sock, user_cmd)	# Send USER command
			nick_cmd = irc.nick(nick)	# Formulate NICK command
			transmit(sock, nick_cmd)	# Send NICK command
			break
	# Stage 2: join channel once the server sets our mode
	while True:
		msg = receive(sock)
		# Check if the server has set a mode for us
		if join_trigger in msg:
			join_cmd = irc.join(chan)	# Formulate JOIN command
			transmit(sock, join_cmd)	# Send JOIN command
			break
Example #4
0
bot_nick = "blackjackbot"
password = ""
bot_channel = "##blackjack"
user_tracker = usertracker.UserTracker()
with open("savefile", "r") as savefile:
    user_tracker.load_state(savefile)

delay = .35
antiflood_timer = 0
antiflood_cooldown = 5

while True:
    irc = irc.Irc()
    irc.connect(host, port, True)
    irc.nick(bot_nick)
    irc.user(bot_nick)

    blackjack = None
    timer = 0

    bantracker = ban.BanTracker()

    dd = False

    while True:
        irc.update_message_queue()

        if irc.message_queue == []:
            break

        for message in irc.message_queue: