def outFilter(self, irc, msg):
     if msg.command == 'PRIVMSG':
         if ircmsgs.isAction(msg):
             s = ircmsgs.unAction(msg)
         else:
             s = msg.args[1]
         reply = []
         bananaProb = 0.1
         maybeBanana = False
         chance = random.random()
         self.log.debug("bananchance: "+str(chance)+" "+str(bananaProb)+" "+s)
         if chance < bananaProb:
             for word in s.split():
                 if maybeBanana:
                     maybeBanana = False
                     chance = random.random()
                     reply.append("banana")
                 else:
                     reply.append(word)
                 if word == "the":
                     maybeBanana = True
             if ircmsgs.isAction(msg):
                 msg = ircmsgs.action(msg.args[0], " ".join(reply), msg=msg)
             else:
                 msg = ircmsgs.IrcMsg(msg = msg, args=(msg.args[0], " ".join(reply)))
     return msg
 def outFilter(self, irc, msg):
     if msg.command == 'PRIVMSG':
         if ircmsgs.isAction(msg):
             s = ircmsgs.unAction(msg)
         else:
             s = msg.args[1]
         reply = []
         bananaProb = 0.1
         maybeBanana = False
         chance = random.random()
         self.log.debug("bananchance: " + str(chance) + " " +
                        str(bananaProb) + " " + s)
         if chance < bananaProb:
             for word in s.split():
                 if maybeBanana:
                     maybeBanana = False
                     chance = random.random()
                     reply.append("banana")
                 else:
                     reply.append(word)
                 if word == "the":
                     maybeBanana = True
             if ircmsgs.isAction(msg):
                 msg = ircmsgs.action(msg.args[0], " ".join(reply), msg=msg)
             else:
                 msg = ircmsgs.IrcMsg(msg=msg,
                                      args=(msg.args[0], " ".join(reply)))
     return msg
Ejemplo n.º 3
0
        def __init__(self, irc, victim, wires, detonateTime, goodWire,
                     channel, sender, showArt, showCorrectWire, debug):
            self.victim = victim
            self.detonateTime = detonateTime
            self.wires = wires
            self.goodWire = goodWire
            self.active = True
            self.channel = channel
            self.sender = sender
            self.irc = irc
            self.showArt = showArt
            self.showCorrectWire = showCorrectWire
            self.debug = debug
            self.thrown = False
            self.responded = False
            self.rng = random.Random()
            self.rng.seed()

            if self.debug:
                self.irc.reply('I just created a bomb in {}'.format(channel))

            def detonate():
                self.detonate(irc)

            schedule.addEvent(detonate, time.time() + self.detonateTime, '{}_bomb'.format(self.channel))
            s = 'stuffs a bomb down {}\'s pants.  The timer is set for {} seconds!  There are {} wires.  They are: {}.'.format(self.victim, self.detonateTime, len(wires), utils.str.commaAndify(wires))
            self.irc.queueMsg(ircmsgs.action(self.channel, s))

            if self.victim == irc.nick:
                time.sleep(1)
                cutWire = self.rng.choice(self.wires)
                self.irc.queueMsg(ircmsgs.privmsg(self.channel, '$cutwire {}'.format(cutWire)))
                time.sleep(1)
                self.cutwire(self.irc, cutWire)
Ejemplo n.º 4
0
 def __init__(self, irc, victim, wires, detonateTime, goodWire, channel, sender, showArt, showCorrectWire, debug):
     self.victim = victim
     self.startTime = time.time();
     self.detonateTime = detonateTime
     self.wires = wires
     self.goodWire = goodWire
     self.active = True
     self.channel = channel
     self.sender = sender
     self.irc = irc
     self.showArt = showArt
     self.showCorrectWire = showCorrectWire
     self.debug = debug
     self.thrown = False
     self.responded = False
     self.rng = random.Random()
     self.rng.seed()
     if self.debug:
         self.irc.reply('I just created a bomb in %s' % channel)
     def detonate():
         self.detonate(irc)
     schedule.addEvent(detonate, self.startTime + self.detonateTime, '%s_bomb' % self.channel)
     formattedTime = "%02d:%02d:%02d" % (detonateTime / 3600, detonateTime / 60, detonateTime % 60)
     s = 'stuffs a bomb down %s\'s pants.  The display reads [%s].  The wires are: %s.' % (self.victim, formattedTime, utils.str.commaAndify(wires))
     self.irc.queueMsg(ircmsgs.action(self.channel, s))
     if self.victim == irc.nick:
         time.sleep(1)
         cutWire = self.rng.choice(self.wires)
         self.irc.queueMsg(ircmsgs.privmsg(self.channel, '@cutwire %s' % cutWire))
         time.sleep(1)
         self.cutwire(self.irc, cutWire)
Ejemplo n.º 5
0
 def __init__(self, irc, victim, wires, detonateTime, goodWire, channel, sender, showArt, showCorrectWire, debug):
     self.victim = victim
     self.detonateTime = detonateTime
     self.wires = wires
     self.goodWire = goodWire
     self.active = True
     self.channel = channel
     self.sender = sender
     self.irc = irc
     self.showArt = showArt
     self.showCorrectWire = showCorrectWire
     self.debug = debug
     self.thrown = False
     self.responded = False
     self.rng = random.Random()
     self.rng.seed()
     if self.debug:
         self.irc.reply('I just created a bomb in %s' % channel)
     def detonate():
         self.detonate(irc)
     schedule.addEvent(detonate, time.time() + self.detonateTime, '%s_bomb' % self.channel)
     s = 'stuffs a bomb down %s\'s pants.  The timer is set for %s seconds!  There are %s wires. Use !cut <wire> to defuse the bomb. The wires are: %s.' % (self.victim, self.detonateTime, len(wires), utils.str.commaAndify(wires))
     self.irc.queueMsg(ircmsgs.action(self.channel, s))
     if self.victim == irc.nick:
         time.sleep(1)
         cutWire = self.rng.choice(self.wires)
         self.irc.queueMsg(ircmsgs.privmsg(self.channel, '@cutwire %s' % cutWire))
         time.sleep(1)
         self.cutwire(self.irc, cutWire)
Ejemplo n.º 6
0
        def __init__(self, irc, victim, detonateTime, channel, sender, debug):
            self.victim = victim
            self.startTime = time.time()
            self.detonateTime = detonateTime
            self.active = True
            self.channel = channel
            self.sender = sender
            self.irc = irc
            self.debug = debug
            self.thrown = False
            self.responded = False
            self.rng = random.Random()
            self.rng.seed()
            if self.debug:
                self.irc.reply('I just created a lazor in %s' % channel)

            def detonate():
                self.detonate(irc)

            schedule.addEvent(detonate, self.startTime + self.detonateTime,
                              '%s_lazor' % self.channel)
            formattedTime = "%02d:%02d:%02d" % (
                detonateTime / 3600, detonateTime / 60, detonateTime % 60)
            irc.reply("IMMA CHARGIN MAH LAZOR")
            s = 'charges his lazor'
            self.irc.queueMsg(ircmsgs.action(self.channel, s))
Ejemplo n.º 7
0
        def __init__(self, irc, victim, wires, detonateTime, goodWire, channel,
                     sender, showArt, showCorrectWire, debug):
            self.victim = victim
            self.detonateTime = detonateTime
            self.wires = wires
            self.goodWire = goodWire
            self.active = True
            self.channel = channel
            self.sender = sender
            self.irc = irc
            self.showArt = showArt
            self.showCorrectWire = showCorrectWire
            self.debug = debug
            self.thrown = False
            self.responded = False
            self.rng = random.Random()
            self.rng.seed()
            if self.debug:
                self.irc.reply('I just created a bomb in %s' % channel)

            def detonate():
                self.detonate(irc)

            meNick = 'EnderBlue'
            patNick = 'PatrickC'
            #if meNick.lower() in self.victim.lower() or patNick.lower() in self.victim.lower():
            #self.irc.queueMsg(ircmsgs.action(self.channel, 'You don\'t expect me to bomb my good pal %s, do you?' % self.victim))
            #self.irc.queueMsg(ircmsgs.action(self.channel, 'Here is the payback.'))
            #self.victim = sender
            #self.sender = self.victim

            schedule.addEvent(detonate,
                              time.time() + self.detonateTime,
                              '%s_bomb' % self.channel)
            s = 'stuffs a bomb down %s\'s pants.  The timer is set for %s seconds!  There are %s wires.  They are: %s.' % (
                self.victim, self.detonateTime, len(wires),
                utils.str.commaAndify(wires))
            self.irc.queueMsg(ircmsgs.action(self.channel, s))
            self.irc.queueMsg(
                ircmsgs.action(self.channel, 'Hint: use \'@cutwire [color]\''))
            if self.victim == irc.nick:
                time.sleep(1)
                cutWire = self.rng.choice(self.wires)
                self.irc.queueMsg(
                    ircmsgs.privmsg(self.channel, '@cutwire %s' % cutWire))
                time.sleep(1)
                self.cutwire(self.irc, cutWire)
Ejemplo n.º 8
0
    def smash(self, irc, msg, args, target):
        """<target>

		"Smashes" the target user or inanimate object with an action message.
		"""
        text = self.PickRandom(self.smashes) + " " + target
        irc.queueMsg(ircmsgs.action(ircutils.replyTo(msg), text))
        irc.noReply()
Ejemplo n.º 9
0
        def detonate(self, irc):
            self.active = False
            self.thrown = False
            if self.showCorrectWire:
                # self.irc.reply('Should\'ve gone for the %s wire!' % self.goodWire)
                s = "%s should've gone for the %s wire!" % (self.victim, self.goodWire)
                self.irc.queueMsg(ircmsgs.action(self.channel, s))
            if self.showArt:
                self.irc.sendMsg(
                    ircmsgs.privmsg(self.channel, "\x031,1.....\x0315,1_.\x0314,1-^^---....,\x0315,1,-_\x031,1.......")
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(self.channel, "\x031,1.\x0315,1_--\x0314,1,.';,`.,';,.;;`;,.\x0315,1--_\x031,1...")
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(self.channel, "\x0315,1<,.\x0314,1;'`\".,;`..,;`*.,';`.\x0315,1;'>)\x031,1.")
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(self.channel, "\x0315,1I.:;\x0314,1.,`;~,`.;'`,.;'`,..\x0315,1';`I\x031,1.")
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(self.channel, "\x031,1.\x0315,1\\_.\x0314,1`'`..`';.,`';,`';,\x0315,1_../\x031,1..")
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(self.channel, "\x031,1....\x0315,1```\x0314,1--. . , ; .--\x0315,1'''\x031,1.....")
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel,
                        "\x031,1..........\x034,1I\x031,1.\x038,1I\x037,1I\x031,1.\x038,1I\x034,1I\x031,1...........",
                    )
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel,
                        "\x031,1..........\x034,1I\x031,1.\x037,1I\x038,1I\x031,1.\x037,1I\x034,1I\x031,1...........",
                    )
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel, "\x031,1.......,\x034,1-=\x034,1II\x037,1..I\x034,1.I=-,\x031,1........"
                    )
                )
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel, "\x031,1.......\x034,1`-=\x037,1#$\x038,1%&\x037,1%$#\x034,1=-'\x031,1........"
                    )
                )
            else:
                self.irc.sendMsg(ircmsgs.privmsg(self.channel, "KABOOM!"))
            self.irc.queueMsg(ircmsgs.kick(self.channel, self.victim, "BOOM!"))

            def reinvite():
                if not self.victim in irc.state.channels[self.channel].users:
                    self.irc.queueMsg(ircmsgs.invite(self.victim, self.channel))

            if not self.responded:
                schedule.addEvent(reinvite, time.time() + 5)
Ejemplo n.º 10
0
        def __init__(
            self, irc, victim, wires, detonateTime, goodWire, channel, sender, showArt, showCorrectWire, debug
        ):
            self.victim = victim
            self.detonateTime = detonateTime
            self.wires = wires
            self.goodWire = goodWire
            self.active = True
            self.channel = channel
            self.sender = sender
            self.irc = irc
            self.showArt = showArt
            self.showCorrectWire = showCorrectWire
            self.debug = debug
            self.thrown = False
            self.responded = False
            self.rng = random.Random()
            self.rng.seed()
            if self.debug:
                self.irc.reply("I just created a bomb in %s" % channel)

            def detonate():
                self.detonate(irc)

            meNick = "EnderBlue"
            patNick = "PatrickC"
            # if meNick.lower() in self.victim.lower() or patNick.lower() in self.victim.lower():
            # self.irc.queueMsg(ircmsgs.action(self.channel, 'You don\'t expect me to bomb my good pal %s, do you?' % self.victim))
            # self.irc.queueMsg(ircmsgs.action(self.channel, 'Here is the payback.'))
            # self.victim = sender
            # self.sender = self.victim

            schedule.addEvent(detonate, time.time() + self.detonateTime, "%s_bomb" % self.channel)
            s = (
                "stuffs a bomb down %s's pants.  The timer is set for %s seconds!  There are %s wires.  They are: %s."
                % (self.victim, self.detonateTime, len(wires), utils.str.commaAndify(wires))
            )
            self.irc.queueMsg(ircmsgs.action(self.channel, s))
            self.irc.queueMsg(ircmsgs.action(self.channel, "Hint: use '@cutwire [color]'"))
            if self.victim == irc.nick:
                time.sleep(1)
                cutWire = self.rng.choice(self.wires)
                self.irc.queueMsg(ircmsgs.privmsg(self.channel, "@cutwire %s" % cutWire))
                time.sleep(1)
                self.cutwire(self.irc, cutWire)
Ejemplo n.º 11
0
    def do(self, irc, msg, args, channel, text):
        """<channel> <action>

        Performs <action> in <channel>.
        """
        self._preCheck(irc, msg, channel, 'do')
        self.log.info('Performing %q in %s due to %s.',
                      text, channel, msg.prefix)
        irc.queueMsg(ircmsgs.action(channel, text))
        irc.noReply()
Ejemplo n.º 12
0
    def do(self, irc, msg, args, channel, text):
        """<channel> <action>

        Performs <action> in <channel>.
        """
        self._preCheck(irc, msg, channel, 'do')
        self.log.info('Performing %q in %s due to %s.', text, channel,
                      msg.prefix)
        irc.queueMsg(ircmsgs.action(channel, text))
        irc.noReply()
Ejemplo n.º 13
0
 def __init__(self, irc, victim, wires, detonateTime, goodWire, channel, sender, showArt, showCorrectWire, debug):
     self.victim = victim
     self.detonateTime = detonateTime
     wirelist = utils.str.commaAndify(wires)
     wirelist = wirelist.replace("pink", ircutils.mircColor('pink', '13'))
     wirelist = wirelist.replace("red", ircutils.mircColor('red', '4'))
     wirelist = wirelist.replace("orange", ircutils.mircColor('orange', '7'))
     wirelist = wirelist.replace("yellow", ircutils.mircColor('yellow', '8'))
     wirelist = wirelist.replace("green", ircutils.mircColor('green', '3'))
     wirelist = wirelist.replace("blue", ircutils.mircColor('blue', '12'))
     wirelist = wirelist.replace("grey", ircutils.mircColor('grey', '14'))
     wirelist = wirelist.replace("purple", ircutils.mircColor('purple', '6'))
     wirelist = wirelist.replace("lime", ircutils.mircColor('lime', '9'))
     wirelist = wirelist.replace("teal", ircutils.mircColor('teal', '10'))
     wirelist = wirelist.replace("brown", ircutils.mircColor('brown', '5'))
     wirelist = wirelist.replace("cyan", ircutils.mircColor('cyan', '11'))
     goodWire = goodWire.replace("pink", ircutils.mircColor('pink', '13'))
     goodWire = goodWire.replace("red", ircutils.mircColor('red', '4'))
     goodWire = goodWire.replace("orange", ircutils.mircColor('orange', '7'))
     goodWire = goodWire.replace("yellow", ircutils.mircColor('yellow', '8'))
     goodWire = goodWire.replace("green", ircutils.mircColor('green', '3'))
     goodWire = goodWire.replace("blue", ircutils.mircColor('blue', '12'))
     goodWire = goodWire.replace("grey", ircutils.mircColor('grey', '14'))
     goodWire = goodWire.replace("purple", ircutils.mircColor('purple', '6'))
     goodWire = goodWire.replace("lime", ircutils.mircColor('lime', '9'))
     goodWire = goodWire.replace("teal", ircutils.mircColor('teal', '10'))
     goodWire = goodWire.replace("brown", ircutils.mircColor('brown', '5'))
     goodWire = goodWire.replace("cyan", ircutils.mircColor('cyan', '11'))
     self.wires = wires
     self.goodWire = goodWire
     self.active = True
     self.channel = channel
     self.sender = sender
     self.irc = irc
     self.showArt = showArt
     self.showCorrectWire = showCorrectWire
     self.debug = debug
     self.thrown = False
     self.responded = False
     self.rng = random.Random()
     self.rng.seed()
     if self.debug:
         self.irc.reply('I just created a bomb in %s' % channel)
     def detonate():
         self.detonate(irc)
     schedule.addEvent(detonate, time.time() + self.detonateTime, '%s_bomb' % self.channel)
     s = 'stuffs a bomb down %s\'s pants.  The timer is set for %s seconds!  There are %s wires.  They are: %s.' % (self.victim, self.detonateTime, len(wires), wirelist)
     self.irc.queueMsg(ircmsgs.action(self.channel, s))
     if self.victim == irc.nick:
         time.sleep(3)
         cutWire = self.rng.choice(self.wires)
         self.irc.queueMsg(ircmsgs.privmsg(self.channel, '.cutwire %s' % cutWire))
         time.sleep(3)
         self.cutwire(self.irc, cutWire)
Ejemplo n.º 14
0
        def __init__(self, irc, victim, wires, detonateTime, goodWire, channel, sender, showArt, showCorrectWire, debug):
            self.victim = victim
            self.detonateTime = detonateTime
            self.wires = wires
            self.goodWire = goodWire
            self.active = True
            self.channel = channel
            self.sender = sender
            self.irc = irc
            self.showArt = showArt
            self.showCorrectWire = showCorrectWire
            self.debug = debug
            self.thrown = False
            self.responded = False
            self.rng = random.Random()
            self.rng.seed()
            if self.debug:
                self.irc.reply('I just created a bomb in %s' % channel)
            def detonate():
                self.detonate(irc)
            schedule.addEvent(detonate, time.time() + self.detonateTime, '%s_bomb' % self.channel)
            
            return_val = self._generate_equation()
            
            wire_equations = ["{0}: {1}".format(goodWire, return_val[1])]
            for wire in wires:
                if wire != goodWire:
                    wire_equations.append("{0}: {1}".format(wire, self._generate_equation_that_is_not_this_solution(return_val[0])[1]))
            
            s = 'stuffs a bomb down %s\'s pants.  The timer is set for %s seconds! ' % (self.victim, self.detonateTime)
                
            self.irc.queueMsg(ircmsgs.action(self.channel, s))
            self.irc.queueMsg(ircmsgs.privmsg(self.channel, 'The solution is %s.' % return_val[0]))
            self.irc.queueMsg(ircmsgs.privmsg(self.channel, 'There are %s wires.' % len(wire_equations)))
            self.irc.queueMsg(ircmsgs.privmsg(self.channel, 'They are:'))

            wire_equations = random.sample(wire_equations, len(wire_equations))
            chunk_size = 4
            equation_chunks = [wire_equations[i:i+chunk_size] for i in range(0, len(wire_equations), chunk_size)]
            for chunk in equation_chunks:
                self.irc.queueMsg(ircmsgs.privmsg(self.channel, utils.str.commaAndify(chunk)))


            if self.victim == irc.nick:
                time.sleep(1)
                cutWire = self.rng.choice(self.wires)
                self.irc.queueMsg(ircmsgs.privmsg(self.channel, '@cutwire %s' % cutWire))
                time.sleep(1)
                self.cutwire(self.irc, cutWire)
Ejemplo n.º 15
0
        def __init__(self, irc, victim, wires, detonateTime, goodWire, channel, sender, showArt, showCorrectWire, debug):
            self.victim = victim
            self.detonateTime = detonateTime
            self.wires = wires
            self.goodWire = goodWire
            self.active = True
            self.channel = channel
            self.sender = sender
            self.irc = irc
            self.showArt = showArt
            self.showCorrectWire = showCorrectWire
            self.debug = debug
            self.thrown = False
            self.responded = False
            self.rng = random.Random()
            self.rng.seed()
            if self.debug:
                self.irc.reply('I just created a bomb in %s' % channel)
            def detonate():
                self.detonate(irc)
            schedule.addEvent(detonate, time.time() + self.detonateTime, '%s_bomb' % self.channel)
            
            return_val = self._generate_equation()
            
            wire_equations = ["{0}: {1}".format(goodWire, return_val[1])]
            for wire in wires:
                if wire != goodWire:
                    wire_equations.append("{0}: {1}".format(wire, self._generate_equation()[1]))
            
            s = 'stuffs a bomb down %s\'s pants.  The timer is set for %s seconds! ' % (self.victim, self.detonateTime)
                
            self.irc.queueMsg(ircmsgs.action(self.channel, s))
            self.irc.queueMsg(ircmsgs.privmsg(self.channel, 'The solution is %s.' % return_val[0]))
            self.irc.queueMsg(ircmsgs.privmsg(self.channel, 'There are %s wires.' % len(wire_equations)))
            self.irc.queueMsg(ircmsgs.privmsg(self.channel, 'They are:'))

            wire_equations = random.sample(wire_equations, len(wire_equations))
            chunk_size = 4
            equation_chunks = [wire_equations[i:i+chunk_size] for i in range(0, len(wire_equations), chunk_size)]
            for chunk in equation_chunks:
                self.irc.queueMsg(ircmsgs.privmsg(self.channel, utils.str.commaAndify(chunk)))


            if self.victim == irc.nick:
                time.sleep(1)
                cutWire = self.rng.choice(self.wires)
                self.irc.queueMsg(ircmsgs.privmsg(self.channel, '@cutwire %s' % cutWire))
                time.sleep(1)
                self.cutwire(self.irc, cutWire)
Ejemplo n.º 16
0
 def outFilter(self, irc, msg):
     if msg.command == 'PRIVMSG':
         if msg.args[0] in self.outFilters:
             if ircmsgs.isAction(msg):
                 s = ircmsgs.unAction(msg)
             else:
                 s = msg.args[1]
             methods = self.outFilters[msg.args[0]]
             for filtercommand in methods:
                 myIrc = MyFilterProxy()
                 filtercommand(myIrc, msg, [s])
                 s = myIrc.s
             if ircmsgs.isAction(msg):
                 msg = ircmsgs.action(msg.args[0], s, msg=msg)
             else:
                 msg = ircmsgs.IrcMsg(msg=msg, args=(msg.args[0], s))
     return msg
Ejemplo n.º 17
0
    def kill(self, irc, msg, args, target):
        """<target>

		"Kills" the target user or inanimate object with an action message.
		"""

        # check if target is immortal
        ltarget = target.lower()
        # make sure we match a whole word
        for x in self.immortals.keys():
            if re.search(r'\b' + x + r'\b', ltarget):
                irc.reply(self.immortals[x])
                return

        # OK, we can kill them
        text = self.PickRandom(
            self.attacks) + " " + target + " with " + self.PickRandom(
                self.weapons)
        irc.queueMsg(ircmsgs.action(ircutils.replyTo(msg), text))
        irc.noReply()
Ejemplo n.º 18
0
 def __init__(self, irc, victim, detonateTime, channel, sender, debug):
     self.victim = victim
     self.startTime = time.time();
     self.detonateTime = detonateTime
     self.active = True
     self.channel = channel
     self.sender = sender
     self.irc = irc
     self.debug = debug
     self.thrown = False
     self.responded = False
     self.rng = random.Random()
     self.rng.seed()
     if self.debug:
         self.irc.reply('I just created a lazor in %s' % channel)
     def detonate():
         self.detonate(irc)
     schedule.addEvent(detonate, self.startTime + self.detonateTime, '%s_lazor' % self.channel)
     formattedTime = "%02d:%02d:%02d" % (detonateTime / 3600, detonateTime / 60, detonateTime % 60)
     irc.reply ("IMMA CHARGIN MAH LAZOR")
     s = 'charges his lazor'
     self.irc.queueMsg(ircmsgs.action(self.channel, s))
Ejemplo n.º 19
0
    def slap(self, irc, msg, args, channel, victim, number):
        """[<channel>] [<nick>] [<times>]

        Act optionally directed at a random string, person,
        object, etc.
        <times> can be used to slap more than one times
        """
        MaxSlaps = self.registryValue("MaxSlaps")
        #self.log.debug("slap: "+channel)
        if not victim: # no victim given
            victim = msg.nick
        if not channel: # no channel given
            channel = msg.args[0]
            if irc.nick == channel: #private chat
                channel = msg.nick
        if not number:
            number = 1
        if number > MaxSlaps:
            if MaxSlaps != 0:
                number = MaxSlaps
        for i in range(number):
            text = string.replace(self._buildSlap(), "$nick", victim)
            irc.queueMsg(ircmsgs.action(channel, text))
Ejemplo n.º 20
0
        def __init__(
            self, irc, victim, wires, detonateTime, goodWire, channel, sender, showArt, showCorrectWire, debug
        ):
            self.victim = victim
            self.detonateTime = detonateTime
            self.wires = wires
            self.goodWire = goodWire
            self.active = True
            self.channel = channel
            self.sender = sender
            self.irc = irc
            self.showArt = showArt
            self.showCorrectWire = showCorrectWire
            self.debug = debug
            self.thrown = False
            self.responded = False
            self.rng = random.Random()
            self.rng.seed()

            if self.debug:
                self.irc.reply("I just created a bomb in {}".format(channel))

            def detonate():
                self.detonate(irc)

            schedule.addEvent(detonate, time.time() + self.detonateTime, "{}_bomb".format(self.channel))
            s = "stuffs a bomb down {}'s pants.  The timer is set for {} seconds!  There are {} wires.  They are: {}.".format(
                self.victim, self.detonateTime, len(wires), utils.str.commaAndify(wires)
            )
            self.irc.queueMsg(ircmsgs.action(self.channel, s))

            if self.victim == irc.nick:
                time.sleep(1)
                cutWire = self.rng.choice(self.wires)
                self.irc.queueMsg(ircmsgs.privmsg(self.channel, "$cutwire {}".format(cutWire)))
                time.sleep(1)
                self.cutwire(self.irc, cutWire)
Ejemplo n.º 21
0
    def summon(self, irc, msg, args, what):
        """<what>

		Summons someone or something from who knows where...
		"""
        text = self.PickRandom(self.summons)
        text = text.replace("{what}", what)
        for i in range(0, 10):  # get different words for each replacement
            text = text.replace("{adjective}",
                                self.PickRandom(self.summonadjectives), 1)
            text = text.replace("{noun}", self.PickRandom(self.summonnouns), 1)
            text = text.replace("{verb}", self.PickRandom(self.summonverbs), 1)
            text = text.replace("{latin}", self.PickRandom(self.summonlatins),
                                1)
            text = text.replace("{creature}",
                                self.PickRandom(self.summoncreatures), 1)
            text = text.replace("{bodypart}",
                                self.PickRandom(self.summonbodyparts), 1)
            text = text.replace("{stuff}", self.PickRandom(self.summonstuffs),
                                1)
            text = text.replace("{place}", self.PickRandom(self.summonplaces),
                                1)
        irc.queueMsg(ircmsgs.action(ircutils.replyTo(msg), text))
        irc.noReply()
Ejemplo n.º 22
0
    def timebomb(self, irc, msg, args, channel, victim):
        """<nick>

        For bombing people!"""
        channel = ircutils.toLower(channel)
        if not self.registryValue("allowBombs", msg.args[0]):
            irc.reply(
                "Timebombs aren't allowed in this channel.  Set plugins.Timebomb.allowBombs to true if you want them."
            )
            return
        try:
            if self.bombs[channel].active:
                irc.reply("There's already an active bomb, in %s's pants!" % self.bombs[channel].victim)
                return
        except KeyError:
            pass
        if victim == irc.nick and not self.registryValue("allowSelfBombs", msg.args[0]):
            irc.reply(
                "You really expect me to bomb myself?  Stuffing explosives into my own pants isn't exactly my idea of fun."
            )
            return
        victim = string.lower(victim)
        found = False
        for nick in list(irc.state.channels[channel].users):
            if victim == string.lower(nick):
                victim = nick
                found = True
        if not found:
            irc.reply("Error: nick not found.")
            return
        sender = msg.nick
        for nick in self.registryValue("exclusions", msg.args[0]):
            if nick.lower() in victim.lower():
                # def randombomb(self, irc, msg, args, channel, nicks):
                irc.queueMsg(ircmsgs.action(channel, "You don't expect me to bomb my good pal %s, do you?" % victim))
                irc.queueMsg(ircmsgs.action(channel, "Here is the payback."))
                # randombomb(irc, msg, args, channel, any('NickInChannel'))
                sender = victim
                victim = msg.nick
                break

        detonateTime = self.rng.randint(
            self.registryValue("minTime", msg.args[0]), self.registryValue("maxTime", msg.args[0])
        )
        wireCount = self.rng.randint(
            self.registryValue("minWires", msg.args[0]), self.registryValue("maxWires", msg.args[0])
        )
        if wireCount < 12:
            colors = self.registryValue("shortcolors")
        else:
            colors = self.registryValue("colors")
        # colors = self.registryValue('colors')
        wires = self.rng.sample(colors, wireCount)
        goodWire = self.rng.choice(wires)
        if self.registryValue("debug"):
            irc.reply("I'm about to create a bomb in %s" % channel)
        self.bombs[channel] = self.Bomb(
            irc,
            victim,
            wires,
            detonateTime,
            goodWire,
            channel,
            sender,
            self.registryValue("showArt", msg.args[0]),
            self.registryValue("showCorrectWire", msg.args[0]),
            self.registryValue("debug"),
        )
        if self.registryValue("debug"):
            irc.reply("This message means that I got past the bomb creation line in the timebomb command")
Ejemplo n.º 23
0
        def __init__(self, irc, victim, wires, detonateTime, goodWire, channel,
                     sender, showArt, showCorrectWire, debug):
            self.victim = victim
            self.detonateTime = detonateTime
            wirelist = utils.str.commaAndify(wires)
            wirelist = wirelist.replace("pink",
                                        ircutils.mircColor('pink', '13'))
            wirelist = wirelist.replace("red", ircutils.mircColor('red', '4'))
            wirelist = wirelist.replace("orange",
                                        ircutils.mircColor('orange', '7'))
            wirelist = wirelist.replace("yellow",
                                        ircutils.mircColor('yellow', '8'))
            wirelist = wirelist.replace("green",
                                        ircutils.mircColor('green', '3'))
            wirelist = wirelist.replace("blue",
                                        ircutils.mircColor('blue', '12'))
            wirelist = wirelist.replace("grey",
                                        ircutils.mircColor('grey', '14'))
            wirelist = wirelist.replace("purple",
                                        ircutils.mircColor('purple', '6'))
            wirelist = wirelist.replace("lime",
                                        ircutils.mircColor('lime', '9'))
            wirelist = wirelist.replace("teal",
                                        ircutils.mircColor('teal', '10'))
            wirelist = wirelist.replace("brown",
                                        ircutils.mircColor('brown', '5'))
            wirelist = wirelist.replace("cyan",
                                        ircutils.mircColor('cyan', '11'))
            goodWire = goodWire.replace("pink",
                                        ircutils.mircColor('pink', '13'))
            goodWire = goodWire.replace("red", ircutils.mircColor('red', '4'))
            goodWire = goodWire.replace("orange",
                                        ircutils.mircColor('orange', '7'))
            goodWire = goodWire.replace("yellow",
                                        ircutils.mircColor('yellow', '8'))
            goodWire = goodWire.replace("green",
                                        ircutils.mircColor('green', '3'))
            goodWire = goodWire.replace("blue",
                                        ircutils.mircColor('blue', '12'))
            goodWire = goodWire.replace("grey",
                                        ircutils.mircColor('grey', '14'))
            goodWire = goodWire.replace("purple",
                                        ircutils.mircColor('purple', '6'))
            goodWire = goodWire.replace("lime",
                                        ircutils.mircColor('lime', '9'))
            goodWire = goodWire.replace("teal",
                                        ircutils.mircColor('teal', '10'))
            goodWire = goodWire.replace("brown",
                                        ircutils.mircColor('brown', '5'))
            goodWire = goodWire.replace("cyan",
                                        ircutils.mircColor('cyan', '11'))
            self.wires = wires
            self.goodWire = goodWire
            self.active = True
            self.channel = channel
            self.sender = sender
            self.irc = irc
            self.showArt = showArt
            self.showCorrectWire = showCorrectWire
            self.debug = debug
            self.thrown = False
            self.responded = False
            self.rng = random.Random()
            self.rng.seed()
            if self.debug:
                self.irc.reply('I just created a bomb in %s' % channel)

            def detonate():
                self.detonate(irc)

            schedule.addEvent(detonate,
                              time.time() + self.detonateTime,
                              '%s_bomb' % self.channel)
            s = 'stuffs a bomb down %s\'s pants.  The timer is set for %s seconds!  There are %s wires.  They are: %s.' % (
                self.victim, self.detonateTime, len(wires), wirelist)
            self.irc.queueMsg(ircmsgs.action(self.channel, s))
            if self.victim == irc.nick:
                time.sleep(3)
                cutWire = self.rng.choice(self.wires)
                self.irc.queueMsg(
                    ircmsgs.privmsg(self.channel, '.cutwire %s' % cutWire))
                time.sleep(3)
                self.cutwire(self.irc, cutWire)
Ejemplo n.º 24
0
        def detonate(self, irc):
            self.active = False
            self.thrown = False
            if self.showCorrectWire:
                #self.irc.reply('Should\'ve gone for the %s wire!' % self.goodWire)
                s = '%s should\'ve gone for the %s wire!' % (self.victim,
                                                             self.goodWire)
                self.irc.queueMsg(ircmsgs.action(self.channel, s))
            if self.showArt:
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel,
                        '\x031,1.....\x0315,1_.\x0314,1-^^---....,\x0315,1,-_\x031,1.......'
                    ))
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel,
                        '\x031,1.\x0315,1_--\x0314,1,.\';,`.,\';,.;;`;,.\x0315,1--_\x031,1...'
                    ))
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel,
                        '\x0315,1<,.\x0314,1;\'`".,;`..,;`*.,\';`.\x0315,1;\'>)\x031,1.'
                    ))
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel,
                        '\x0315,1I.:;\x0314,1.,`;~,`.;\'`,.;\'`,..\x0315,1\';`I\x031,1.'
                    ))
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel,
                        '\x031,1.\x0315,1\\_.\x0314,1`\'`..`\';.,`\';,`\';,\x0315,1_../\x031,1..'
                    ))
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel,
                        '\x031,1....\x0315,1```\x0314,1--. . , ; .--\x0315,1\'\'\'\x031,1.....'
                    ))
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel,
                        '\x031,1..........\x034,1I\x031,1.\x038,1I\x037,1I\x031,1.\x038,1I\x034,1I\x031,1...........'
                    ))
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel,
                        '\x031,1..........\x034,1I\x031,1.\x037,1I\x038,1I\x031,1.\x037,1I\x034,1I\x031,1...........'
                    ))
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel,
                        '\x031,1.......,\x034,1-=\x034,1II\x037,1..I\x034,1.I=-,\x031,1........'
                    ))
                self.irc.sendMsg(
                    ircmsgs.privmsg(
                        self.channel,
                        '\x031,1.......\x034,1`-=\x037,1#$\x038,1%&\x037,1%$#\x034,1=-\'\x031,1........'
                    ))
            else:
                self.irc.sendMsg(ircmsgs.privmsg(self.channel, 'KABOOM!'))
            self.irc.queueMsg(ircmsgs.kick(self.channel, self.victim, 'BOOM!'))

            def reinvite():
                if not self.victim in irc.state.channels[self.channel].users:
                    self.irc.queueMsg(ircmsgs.invite(self.victim,
                                                     self.channel))

            if not self.responded:
                schedule.addEvent(reinvite, time.time() + 5)
Ejemplo n.º 25
0
    def roulette(self, irc, msg, args, nick):
        """[spin|nick]

        Fires the revolver.  If the bullet was in the chamber, you're dead.
        Tell me to spin the chambers and I will.
        """
        
        chamberSize = self._chamberSizeMax
        #if spin:
        channel = msg.args[0]
        
        if channel not in self._rouletteChamber:
            self._rouletteChamber[channel] = self.rng.randrange(self._chamberMin, self._chamberMax)
            self._rouletteBullet[channel] = self.rng.randrange(self._bulletMin, self._bulletMax)
        
        if nick.lower() == 'spin':
            self._rouletteBullet[channel] = self.rng.randrange(0, chamberSize)
            irc.reply('*SPIN* Are you feeling lucky?', prefixNick=False)
            return
        
        nickFound = False
        if nick.lower() == '':
            nick = msg.nick
            nickFound = True
        elif nick.lower() == 'random':
            nicks = list(irc.state.channels[channel].users)
            if len(nicks) >= 2:
                nickCount = 0
                nick = self.rng.choice(nicks)
                while nickCount < 99 and nick in self.registryValue('exclusions', msg.args[0]):
                    nick = self.rng.choice(nicks)
                    nickCount += 1
                    
                if nickCount >= 98:
                    nick = msg.nick
                
            else:
                nick = msg.nick
                
            nickFound = True
        elif nick.lower() == msg.nick.lower():
            nick = nick
            nickFound = True
        else:
            for nickTry in self.registryValue('exclusions', channel):
                if nick.lower() == nickTry.lower():
                    irc.sendMsg(ircmsgs.action(channel, '%s rips the pistol out of your hand and points it at you!' % nick))
                    nick = msg.nick
                    nickFound = True
                    break
            if not nickFound:
                for nickTry in list(irc.state.channels[channel].users):
                    if nick.lower() == nickTry.lower():
                        nick = nick
                        nickFound = True
                        break
        if not nickFound:
            nick = msg.nick
            irc.reply('%s: You didn\'t point the pistol at a real Nick, so it defaults to you :)' % nick, prefixNick=False)
            
        if self._rouletteChamber[channel] == self._rouletteBullet[channel]:
            self._rouletteChamber[channel] = self.rng.randrange(self._chamberMin, self._chamberMax)
            self._rouletteBullet[channel] = self.rng.randrange(self._bulletMin, self._bulletMax)
            if irc.nick in irc.state.channels[channel].ops:
                irc.sendMsg(ircmsgs.privmsg(channel, '%s: BANG!!' % nick))
                irc.queueMsg(ircmsgs.kick(channel, nick, 'BANG!'))
            else:
                irc.reply('*BANG* Hey, who put a blank in here?!',
                          prefixNick=False)
            irc.reply('reloads and spins the chambers.', action=True)
        else:
            irc.sendMsg(ircmsgs.privmsg(channel, '%s: *click*' % nick))
            self._rouletteChamber[channel] += 1
            self._rouletteChamber[channel] %= chamberSize
Ejemplo n.º 26
0
        def __init__(
            self,
            irc,
            victim,
            wires,
            detonateTime,
            goodWire,
            channel,
            sender,
            showArt,
            showCorrectWire,
            debug,
        ):
            self.victim = victim
            self.detonateTime = detonateTime
            self.wires = wires
            self.goodWire = goodWire
            self.active = True
            self.channel = channel
            self.sender = sender
            self.irc = irc
            self.showArt = showArt
            self.showCorrectWire = showCorrectWire
            self.debug = debug
            self.thrown = False
            self.rethrown = False
            self.responded = False
            self.rng = random.Random()
            self.rng.seed()

            def get(group):
                v = group.getSpecific(channel=channel)
                return v()

            try:
                self.command_char = get(
                    conf.supybot.reply.whenAddressedBy.chars)[0]
            except:
                self.command_char = ""
            if self.debug:
                self.irc.reply("I just created a bomb in {}.".format(channel))

            def detonate():
                self.detonate(irc)

            schedule.addEvent(
                detonate,
                time.time() + self.detonateTime,
                "{}_bomb".format(self.channel),
            )
            s = (
                "stuffs a bomb down {}'s pants. The timer is set for {} seconds! There"
                " are {} wires. They are: {}.".format(
                    self.victim,
                    self.detonateTime,
                    len(wires),
                    utils.str.commaAndify(wires),
                ))
            self.irc.queueMsg(ircmsgs.action(self.channel, s))
            self.irc.queueMsg(
                ircmsgs.privmsg(
                    self.channel,
                    "{}, try to defuse the bomb using the command: '{}cutwire"
                    " \x02color\x02'".format(self.victim, self.command_char),
                ))

            if self.victim == irc.nick:
                time.sleep(1)
                cutWire = self.rng.choice(self.wires)
                self.irc.queueMsg(
                    ircmsgs.privmsg(self.channel,
                                    "$cutwire {}".format(cutWire)))
                time.sleep(1)
                self.cutwire(self.irc, cutWire)
Ejemplo n.º 27
0
 def me(self, msg):
     self.irc.queueMsg(ircmsgs.action(self.channel, msg))
     self.irc.noReply()
Ejemplo n.º 28
0
 def testUnAction(self):
     s = 'foo bar baz'
     msg = ircmsgs.action('#foo', s)
     self.assertEqual(ircmsgs.unAction(msg), s)
Ejemplo n.º 29
0
 def hugme(self, irc, msg, match):
     r""".*hug.*ubotu"""
     irc.queueMsg(ircmsgs.action(msg.args[0], self.hugs[random.randint(0, len(self.hugs) - 1)] % msg.nick))
Ejemplo n.º 30
0
 def doPrivmsg(self, irc, msg):
     if ircutils.isChannel(msg.args[0]) and self.registryValue("enable", msg.args[0]):
         dots = "." * random.randint(0,10) # added emphasis...............
         ow = "ow"+("w"*random.randint(0,4))
         volatile = ("kicks ", "stabs ", "fites ", "bans ", "ddas ", "packets ", "beats ")
         exclaim = (("!" * random.randint(1,5)) + ("1" * random.randint(0,2))) * \
             random.randint(1,2) + ("!" * random.randint(-1,5))
         gemotes = ["xD", "=']", "\\o/", ":"+"3"*random.randint(1,4), "^_^"]
         meh = (";/", ":\\", ":/")
         bemotes = meh + (":(", ":|", '-_-')
         semotes = (":<", ";_;", ";-;", "D:", ">:", "x(")
         if irc.network.lower() == "overdrive-irc":
             if "fishbot" in irc.state.channels[msg.args[0]].users:
                 hurtresponses = [ow, random.choice(semotes), 
                     ow+random.choice(semotes), "RIP", "i cry",
                     "ouch", "what was that for "+random.choice(semotes),
                     "!voteban "+msg.nick, "PLS", "rood", "owowowowow", 
                     "omg "+random.choice(semotes), 
                     "hey, bots have feelings too!"+random.choice(semotes),
                     "wtf", "watch it!", "wow"]
                 if re.match(r"^\x01ACTION ((attacks|stabs) {n} with |"
                     r"(drops|throws|casts|thwacks) (.*? (at|on|with) "
                     r"{n}|{n} (at|on|with) .*?)|fites {n}).*?\x01$".\
                     format(n=irc.nick), msg.args[1].lower(), re.I):
                     sleep(0.4)
                     n = random.random()
                     if n >= 0.45:
                         irc.queueMsg(ircmsgs.action(msg.args[0], self._attack(msg.nick)))
                     else:
                         irc.queueMsg(ircmsgs.privmsg(msg.args[0], random.choice(hurtresponses)))
             if "wow" in irc.state.channels[msg.args[0]].ops and \
                 ircutils.stripFormatting(msg.args[1].lower().split()[0]) == "wow":
                 wowResponses1 = ["what is it",
                                 "hi %s%s" % (msg.nick, dots),
                                 "o/",
                                 "HI %s%s" % (msg.nick.upper(), dots),
                                 "go away "+random.choice(bemotes),
                                 "FFS "+random.choice(bemotes),
                                 "ffs i'm trying to work",
                                 "WHAT DO YOU WANT",
                                 "leave me alone "+random.choice(bemotes),
                                 "hello, you've reached 'wow'. "
                                     "If you actually need to talk to me, "
                                     "press 1. if not, PISS OFF!",
                                 "stop highlighting me" + dots,
                                 "reproted to fbi for harassment" + dots,
                                 "-_-",
                                 msg.nick + " pls",
                                 "need something?",
                                 "r u mad",
                                 "ur made",
                                 "fml",
                                 "?",
                                 ".",
                                 "meh "+random.choice(meh),
                                 "/join 0",
                                 "/part SCREW U GUYS IM LEAVING AND NEVER COMING "
                                     "BACK AGAIN!! IT'S ALL %s'S FAULT I FKN HATE "
                                     "YOU ALL \x02</3" % msg.nick.upper(),
                                 "stop highlighting me!",
                                 "\x02%s\x02 added to ignore list." % msg.nick,
                                 "!votekline " + msg.nick]
                 n = random.randint(0, 91)
                 if n >= 60:
                     irc.queueMsg(ircmsgs.privmsg("BotServ", "say {} {}".format(msg.args[0],random.choice(wowResponses1))))
                 elif n >= 50:
                     irc.queueMsg(ircmsgs.privmsg("BotServ", "act {} {}".format(msg.args[0],random.choice(volatile)+msg.nick)))
             if ircutils.stripFormatting(msg.args[1]) == ".":
                 dotresponses = ["r u mad?", "lol r u mad", "mmm dots", ",", "no spam pls" + dots, ":D", "ok"]
                 if len(self.dotCounter) >= 2:
                     r = random.random()
                     if r >= 0.5:
                         irc.queueMsg(ircmsgs.privmsg(msg.args[0], random.choice(dotresponses)))
                 else: self.dotCounter.enqueue([0])
             elif ircutils.stripFormatting(msg.args[1]) == "ok":
                 okresponses = ["not ok", "ok", "ko",
                     "okay*", "O.K.", "^why does everyone say that ._.",
                     "\x01ACTION ok's %s\x01" % msg.nick,
                     "no", "Objection! \x02Not\x02 okay!", "meh "+random.choice(meh),
                     "yeah ok w/e man.", "\x01ACTION sighs\x01",
                     "you're pretty ok.", "hmph", "I AGREE WITH YOU, "+msg.nick+dots]
                 r = random.randint(1, 23)
                 if r >= 19:
                     irc.queueMsg(ircmsgs.action(msg.args[0], random.choice(volatile)+msg.nick))
                 elif r >= 7:
                     irc.queueMsg(ircmsgs.privmsg(msg.args[0], random.choice(okresponses)))
         if irc.network.lower() in ("overdrive-irc", "stripechat") and \
             "hitl"+"er blossom" in ircutils.stripFormatting(msg.args[1].lower()):
             irc.queueMsg(ircmsgs.privmsg(msg.args[0], msg.nick + ": the entire topic changes" + exclaim))
Ejemplo n.º 31
0
    def roulette(self, irc, msg, args, nick):
        """[spin|nick]

        Fires the revolver.  If the bullet was in the chamber, you're dead.
        Tell me to spin the chambers and I will.
        """

        chamberSize = self._chamberSizeMax
        #if spin:
        channel = msg.args[0]

        if channel not in self._rouletteChamber:
            self._rouletteChamber[channel] = self.rng.randrange(
                self._chamberMin, self._chamberMax)
            self._rouletteBullet[channel] = self.rng.randrange(
                self._bulletMin, self._bulletMax)

        if nick.lower() == 'spin':
            self._rouletteBullet[channel] = self.rng.randrange(0, chamberSize)
            irc.reply('*SPIN* Are you feeling lucky?', prefixNick=False)
            return

        nickFound = False
        if nick.lower() == '':
            nick = msg.nick
            nickFound = True
        elif nick.lower() == 'random':
            nicks = list(irc.state.channels[channel].users)
            if len(nicks) >= 2:
                nickCount = 0
                nick = self.rng.choice(nicks)
                while nickCount < 99 and nick in self.registryValue(
                        'exclusions', msg.args[0]):
                    nick = self.rng.choice(nicks)
                    nickCount += 1

                if nickCount >= 98:
                    nick = msg.nick

            else:
                nick = msg.nick

            nickFound = True
        elif nick.lower() == msg.nick.lower():
            nick = nick
            nickFound = True
        else:
            for nickTry in self.registryValue('exclusions', channel):
                if nick.lower() == nickTry.lower():
                    irc.sendMsg(
                        ircmsgs.action(
                            channel,
                            '%s rips the pistol out of your hand and points it at you!'
                            % nick))
                    nick = msg.nick
                    nickFound = True
                    break
            if not nickFound:
                for nickTry in list(irc.state.channels[channel].users):
                    if nick.lower() == nickTry.lower():
                        nick = nick
                        nickFound = True
                        break
        if not nickFound:
            nick = msg.nick
            irc.reply(
                '%s: You didn\'t point the pistol at a real Nick, so it defaults to you :)'
                % nick,
                prefixNick=False)

        if self._rouletteChamber[channel] == self._rouletteBullet[channel]:
            self._rouletteChamber[channel] = self.rng.randrange(
                self._chamberMin, self._chamberMax)
            self._rouletteBullet[channel] = self.rng.randrange(
                self._bulletMin, self._bulletMax)
            if irc.nick in irc.state.channels[channel].ops:
                irc.sendMsg(ircmsgs.privmsg(channel, '%s: BANG!!' % nick))
                irc.queueMsg(ircmsgs.kick(channel, nick, 'BANG!'))
            else:
                irc.reply('*BANG* Hey, who put a blank in here?!',
                          prefixNick=False)
            irc.reply('reloads and spins the chambers.', action=True)
        else:
            irc.sendMsg(ircmsgs.privmsg(channel, '%s: *click*' % nick))
            self._rouletteChamber[channel] += 1
            self._rouletteChamber[channel] %= chamberSize
Ejemplo n.º 32
0
 def testUnAction(self):
     s = 'foo bar baz'
     msg = ircmsgs.action('#foo', s)
     self.assertEqual(ircmsgs.unAction(msg), s)
Ejemplo n.º 33
0
    def timebomb(self, irc, msg, args, channel, victim):
        """<nick>

        For bombing people!"""
        channel = ircutils.toLower(channel)
        if not self.registryValue('allowBombs', msg.args[0]):
            irc.reply(
                'Timebombs aren\'t allowed in this channel.  Set plugins.Timebomb.allowBombs to true if you want them.'
            )
            return
        try:
            if self.bombs[channel].active:
                irc.reply('There\'s already an active bomb, in %s\'s pants!' %
                          self.bombs[channel].victim)
                return
        except KeyError:
            pass
        if victim == irc.nick and not self.registryValue(
                'allowSelfBombs', msg.args[0]):
            irc.reply(
                'You really expect me to bomb myself?  Stuffing explosives into my own pants isn\'t exactly my idea of fun.'
            )
            return
        victim = string.lower(victim)
        found = False
        for nick in list(irc.state.channels[channel].users):
            if victim == string.lower(nick):
                victim = nick
                found = True
        if not found:
            irc.reply('Error: nick not found.')
            return
        sender = msg.nick
        for nick in self.registryValue('exclusions', msg.args[0]):
            if nick.lower() in victim.lower():
                #def randombomb(self, irc, msg, args, channel, nicks):
                irc.queueMsg(
                    ircmsgs.action(
                        channel,
                        'You don\'t expect me to bomb my good pal %s, do you?'
                        % victim))
                irc.queueMsg(ircmsgs.action(channel, 'Here is the payback.'))
                #randombomb(irc, msg, args, channel, any('NickInChannel'))
                sender = victim
                victim = msg.nick
                break

        detonateTime = self.rng.randint(
            self.registryValue('minTime', msg.args[0]),
            self.registryValue('maxTime', msg.args[0]))
        wireCount = self.rng.randint(
            self.registryValue('minWires', msg.args[0]),
            self.registryValue('maxWires', msg.args[0]))
        if wireCount < 12:
            colors = self.registryValue('shortcolors')
        else:
            colors = self.registryValue('colors')
        #colors = self.registryValue('colors')
        wires = self.rng.sample(colors, wireCount)
        goodWire = self.rng.choice(wires)
        if self.registryValue('debug'):
            irc.reply('I\'m about to create a bomb in %s' % channel)
        self.bombs[channel] = self.Bomb(
            irc, victim, wires, detonateTime, goodWire, channel, sender,
            self.registryValue('showArt', msg.args[0]),
            self.registryValue('showCorrectWire', msg.args[0]),
            self.registryValue('debug'))
        if self.registryValue('debug'):
            irc.reply(
                'This message means that I got past the bomb creation line in the timebomb command'
            )
Ejemplo n.º 34
0
    def spin(self, irc, msg, args, game, nick1, chips1, nick2, chips2, nick3, chips3, nick4, chips4, nick5, chips5):
        """<game type> <nick> <chips> [<nick>] [<chips>] [<nick>] [<chips>] [<nick>] [<chips>] [<nick>] [<chips>]

        Plays game of type <game type> for given nicks. There can be min 1 nick and max 5 nicks."""
        pokretac = msg.nick
        channel = msg.args[0]
        achannels = ['#dice', '#Happy.tree.friends']
        ops = irc.state.channels[channel].ops
        if channel in achannels:
            if pokretac in ops:
                if game == 'c':
                    if nick2 is None:
                        read_chips = self.citanje_zetona(channel)
                        if nick1 in read_chips.keys():
                            nick_account = read_chips[nick1]['zetoni']
                            if nick_account - chips1 < 0:
                                irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account." % (nick1, nick_account))
                            else:
                                take_chips = nick_account - chips1
                                self.oduzimanje_zetona(irc, nick1, take_chips, channel)
                                colors = ['red', 'black']
                                select_random_color = random.choice(colors)
                                irc.queueMsg(ircmsgs.action(channel, 'rolls \x02%s\x02 colour.' % select_random_color))
                        else:
                            irc.reply("\x02%s\x02 doesn't even have account." % nick1)
                    elif nick2 is not None and nick3 is None:
                        read_chips = self.citanje_zetona(channel)
                        if nick1 in read_chips.keys() and nick2 in read_chips.keys():
                            nick1_account = read_chips[nick1]['zetoni']
                            nick2_account = read_chips[nick2]['zetoni']
                            if nick1_account - chips1 < 0:
                                irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick1, nick1_account))
                            elif nick2_account - chips2 < 0:
                                irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick2, nick2_account))
                            else:
                                take_chips_nick1 = nick1_account - chips1
                                take_chips_nick2 = nick2_account - chips2
                                self.oduzimanje_zetona(irc, nick1, take_chips_nick1, channel)
                                self.oduzimanje_zetona(irc, nick2, take_chips_nick2, channel)
                                colors = ['red', 'black']
                                select_random_color = random.choice(colors)
                                irc.queueMsg(ircmsgs.action(channel, 'rolls \x02%s\x02 colour.' % select_random_color))
                        else:
                            irc.reply("Some of those players doesn't even have account yet.")
                    elif nick3 is not None and nick4 is None:
                        read_chips = self.citanje_zetona(channel)
                        if nick1 in read_chips.keys() and nick2 in read_chips.keys():
                            if nick3 in read_chips.keys():
                                nick1_account = read_chips[nick1]['zetoni']
                                nick2_account = read_chips[nick2]['zetoni']
                                nick3_account = read_chips[nick3]['zetoni']
                                if nick1_account - chips1 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick1, nick1_account))
                                elif nick2_account - chips2 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick2, nick2_account))
                                elif nick3_account - chips3 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick3, nick3_account))
                                else:
                                    take_chips_nick1 = nick1_account - chips1
                                    take_chips_nick2 = nick2_account - chips2
                                    take_chips_nick3 = nick3_account - chips3
                                    self.oduzimanje_zetona(irc, nick1, take_chips_nick1, channel)
                                    self.oduzimanje_zetona(irc, nick2, take_chips_nick2, channel)
                                    self.oduzimanje_zetona(irc, nick3, take_chips_nick3, channel)
                                    colors = ['red', 'black']
                                    select_random_color = random.choice(colors)
                                    irc.queueMsg(ircmsgs.action(channel, 'rolls \x02%s\x02 colour.' % select_random_color))
                            else:
                                irc.reply("Some of those players doesn't even have account yet.")
                        else:
                            irc.reply("Some of those players doesn't even have account yet.")
                    elif nick4 is not None and nick5 is None:
                        read_chips = self.citanje_zetona(channel)
                        if nick1 in read_chips.keys() and nick2 in read_chips.keys():
                            if nick3 in read_chips.keys() and nick4 in read_chips.keys():
                                nick1_account = read_chips[nick1]['zetoni']
                                nick2_account = read_chips[nick2]['zetoni']
                                nick3_account = read_chips[nick3]['zetoni']
                                nick4_account = read_chips[nick4]['zetoni']
                                if nick1_account - chips1 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick1, nick1_account))
                                elif nick2_account - chips2 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick2, nick2_account))
                                elif nick3_account - chips3 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick3, nick3_account))
                                elif nick4_account - chips4 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick4, nick4_account))
                                else:
                                    take_chips_nick1 = nick1_account - chips1
                                    take_chips_nick2 = nick2_account - chips2
                                    take_chips_nick3 = nick3_account - chips3
                                    take_chips_nick4 = nick4_account - chips4
                                    self.oduzimanje_zetona(irc, nick1, take_chips_nick1, channel)
                                    self.oduzimanje_zetona(irc, nick2, take_chips_nick2, channel)
                                    self.oduzimanje_zetona(irc, nick3, take_chips_nick3, channel)
                                    self.oduzimanje_zetona(irc, nick4, take_chips_nick4, channel)
                                    colors = ['red', 'black']
                                    select_random_color = random.choice(colors)
                                    irc.queueMsg(ircmsgs.action(channel, 'rolls \x02%s\x02 colour.' % select_random_color))
                            else:
                                irc.reply("Some of those players doesn't even have account yet.")
                        else:
                            irc.reply("Some of those players doesn't even have account yet.")
                    elif nick5 is not None and chips5 is not None:
                        read_chips = self.citanje_zetona(channel)
                        if nick1 in read_chips.keys() and nick2 in read_chips.keys():
                            if nick3 in read_chips.keys() and nick4 in read_chips.keys():
                                if nick5 in read_chips.keys():
                                    nick1_account = read_chips[nick1]['zetoni']
                                    nick2_account = read_chips[nick2]['zetoni']
                                    nick3_account = read_chips[nick3]['zetoni']
                                    nick4_account = read_chips[nick4]['zetoni']
                                    nick5_account = read_chips[nick5]['zetoni']
                                    if nick1_account - chips1 < 0:
                                        irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick1, nick1_account))
                                    elif nick2_account - chips2 < 0:
                                        irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick2, nick2_account))
                                    elif nick3_account - chips3 < 0:
                                        irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick3, nick3_account))
                                    elif nick4_account - chips4 < 0:
                                        irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick4, nick4_account))
                                    elif nick5_account - chips5 < 0:
                                        irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick5, nick5_account))
                                    else:
                                        take_chips_nick1 = nick1_account - chips1
                                        take_chips_nick2 = nick2_account - chips2
                                        take_chips_nick3 = nick3_account - chips3
                                        take_chips_nick4 = nick4_account - chips4
                                        take_chips_nick5 = nick5_account - chips5
                                        self.oduzimanje_zetona(irc, nick1, take_chips_nick1, channel)
                                        self.oduzimanje_zetona(irc, nick2, take_chips_nick2, channel)
                                        self.oduzimanje_zetona(irc, nick3, take_chips_nick3, channel)
                                        self.oduzimanje_zetona(irc, nick4, take_chips_nick4, channel)
                                        self.oduzimanje_zetona(irc, nick5, take_chips_nick5, channel)
                                        colors = ['red', 'black']
                                        select_random_color = random.choice(colors)
                                        irc.queueMsg(ircmsgs.action(channel, 'rolls \x02%s\x02 colour.' % select_random_color))
                                else:
                                    irc.reply("Some of those players doesn't even have account yet.")
                            else:
                                irc.reply("Some of those players doesn't even have account yet.")
                        else:
                            irc.reply("Some of those players doesn't even have account yet.")
                elif game == 'hn':
                    if nick2 is None:
                        read_chips = self.citanje_zetona(channel)
                        if nick1 in read_chips.keys():
                            nick_account = read_chips[nick1]['zetoni']
                            if nick_account - chips1 < 0:
                                irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account." % (nick1, nick_account))
                            else:
                                take_chips = nick_account - chips1
                                self.oduzimanje_zetona(irc, nick1, take_chips, channel)
                                numbers = random.sample(range(1000), 1)
                                number = numbers[0]
                                irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number, nick1)))
                        else:
                            irc.reply("\x02%s\x02 doesn't even have account." % nick1)
                    elif nick2 is not None and nick3 is None:
                        read_chips = self.citanje_zetona(channel)
                        if nick1 in read_chips.keys() and nick2 in read_chips.keys():
                            nick1_account = read_chips[nick1]['zetoni']
                            nick2_account = read_chips[nick2]['zetoni']
                            if nick1_account - chips1 < 0:
                                irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick1, nick1_account))
                            elif nick2_account - chips2 < 0:
                                irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick2, nick2_account))
                            else:
                                take_chips_nick1 = nick1_account - chips1
                                take_chips_nick2 = nick2_account - chips2
                                self.oduzimanje_zetona(irc, nick1, take_chips_nick1, channel)
                                self.oduzimanje_zetona(irc, nick2, take_chips_nick2, channel)
                                numbers = random.sample(range(1000), 2)
                                number1 = numbers[0]
                                number2 = numbers[1]
                                irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number1, nick1)))
                                irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number2, nick2)))
                        else:
                            irc.reply("Some of those players doesn't even have account yet.")
                    elif nick3 is not None and nick4 is None:
                        read_chips = self.citanje_zetona(channel)
                        if nick1 in read_chips.keys() and nick2 in read_chips.keys():
                            if nick3 in read_chips.keys():
                                nick1_account = read_chips[nick1]['zetoni']
                                nick2_account = read_chips[nick2]['zetoni']
                                nick3_account = read_chips[nick3]['zetoni']
                                if nick1_account - chips1 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick1, nick1_account))
                                elif nick2_account - chips2 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick2, nick2_account))
                                elif nick3_account - chips3 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick3, nick3_account))
                                else:
                                    take_chips_nick1 = nick1_account - chips1
                                    take_chips_nick2 = nick2_account - chips2
                                    take_chips_nick3 = nick3_account - chips3
                                    self.oduzimanje_zetona(irc, nick1, take_chips_nick1, channel)
                                    self.oduzimanje_zetona(irc, nick2, take_chips_nick2, channel)
                                    self.oduzimanje_zetona(irc, nick3, take_chips_nick3, channel)
                                    numbers = random.sample(range(1000), 3)
                                    number1 = numbers[0]
                                    number2 = numbers[1]
                                    number3 = numbers[2]
                                    irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number1, nick1)))
                                    irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number2, nick2)))
                                    irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number3, nick3)))
                            else:
                                irc.reply("Some of those players doesn't even have account yet.")
                        else:
                            irc.reply("Some of those players doesn't even have account yet.")
                    elif nick4 is not None and nick5 is None:
                        read_chips = self.citanje_zetona(channel)
                        if nick1 in read_chips.keys() and nick2 in read_chips.keys():
                            if nick3 in read_chips.keys() and nick4 in read_chips.keys():
                                nick1_account = read_chips[nick1]['zetoni']
                                nick2_account = read_chips[nick2]['zetoni']
                                nick3_account = read_chips[nick3]['zetoni']
                                nick4_account = read_chips[nick4]['zetoni']
                                if nick1_account - chips1 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick1, nick1_account))
                                elif nick2_account - chips2 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick2, nick2_account))
                                elif nick3_account - chips3 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick3, nick3_account))
                                elif nick4_account - chips4 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick4, nick4_account))
                                else:
                                    take_chips_nick1 = nick1_account - chips1
                                    take_chips_nick2 = nick2_account - chips2
                                    take_chips_nick3 = nick3_account - chips3
                                    take_chips_nick4 = nick4_account - chips4
                                    self.oduzimanje_zetona(irc, nick1, take_chips_nick1, channel)
                                    self.oduzimanje_zetona(irc, nick2, take_chips_nick2, channel)
                                    self.oduzimanje_zetona(irc, nick3, take_chips_nick3, channel)
                                    self.oduzimanje_zetona(irc, nick4, take_chips_nick4, channel)
                                    numbers = random.sample(range(1000), 4)
                                    number1 = numbers[0]
                                    number2 = numbers[1]
                                    number3 = numbers[2]
                                    number4 = numbers[3]
                                    irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number1, nick1)))
                                    irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number2, nick2)))
                                    irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number3, nick3)))
                                    irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number4, nick4)))
                            else:
                                irc.reply("Some of those players doesn't even have account yet.")
                        else:
                            irc.reply("Some of those players doesn't even have account yet.")
                    elif nick5 is not None and chips5 is not None:
                        read_chips = self.citanje_zetona(channel)
                        if nick1 in read_chips.keys() and nick2 in read_chips.keys():
                            if nick3 in read_chips.keys() and nick4 in read_chips.keys():
                                if nick5 in read_chips.keys():
                                    nick1_account = read_chips[nick1]['zetoni']
                                    nick2_account = read_chips[nick2]['zetoni']
                                    nick3_account = read_chips[nick3]['zetoni']
                                    nick4_account = read_chips[nick4]['zetoni']
                                    nick5_account = read_chips[nick5]['zetoni']
                                    if nick1_account - chips1 < 0:
                                        irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick1, nick1_account))
                                    elif nick2_account - chips2 < 0:
                                        irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick2, nick2_account))
                                    elif nick3_account - chips3 < 0:
                                        irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick3, nick3_account))
                                    elif nick4_account - chips4 < 0:
                                        irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick4, nick4_account))
                                    elif nick5_account - chips5 < 0:
                                        irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick5, nick5_account))
                                    else:
                                        take_chips_nick1 = nick1_account - chips1
                                        take_chips_nick2 = nick2_account - chips2
                                        take_chips_nick3 = nick3_account - chips3
                                        take_chips_nick4 = nick4_account - chips4
                                        take_chips_nick5 = nick5_account - chips5
                                        self.oduzimanje_zetona(irc, nick1, take_chips_nick1, channel)
                                        self.oduzimanje_zetona(irc, nick2, take_chips_nick2, channel)
                                        self.oduzimanje_zetona(irc, nick3, take_chips_nick3, channel)
                                        self.oduzimanje_zetona(irc, nick4, take_chips_nick4, channel)
                                        self.oduzimanje_zetona(irc, nick5, take_chips_nick5, channel)
                                        numbers = random.sample(range(1000), 5)
                                        number1 = numbers[0]
                                        number2 = numbers[1]
                                        number3 = numbers[2]
                                        number4 = numbers[3]
                                        number5 = numbers[4]
                                        irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number1, nick1)))
                                        irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number2, nick2)))
                                        irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number3, nick3)))
                                        irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number4, nick4)))
                                        irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number5, nick5)))
                                else:
                                    irc.reply("Some of those players doesn't even have account yet.")
                            else:
                                irc.reply("Some of those players doesn't even have account yet.")
                        else:
                            irc.reply("Some of those players doesn't even have account yet.")
                elif game == 'sn':
                    if nick2 is None:
                        read_chips = self.citanje_zetona(channel)
                        if nick1 in read_chips.keys():
                            nick_account = read_chips[nick1]['zetoni']
                            if nick_account - chips1 < 0:
                                irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account." % (nick1, nick_account))
                            else:
                                take_chips = nick_account - chips1
                                self.oduzimanje_zetona(irc, nick1, take_chips, channel)
                                numbers = random.sample(range(36), 1)
                                number = numbers[0]
                                irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number, nick1)))
                        else:
                            irc.reply("\x02%s\x02 doesn't even have account." % nick1)
                    elif nick2 is not None and nick3 is None:
                        read_chips = self.citanje_zetona(channel)
                        if nick1 in read_chips.keys() and nick2 in read_chips.keys():
                            nick1_account = read_chips[nick1]['zetoni']
                            nick2_account = read_chips[nick2]['zetoni']
                            if nick1_account - chips1 < 0:
                                irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick1, nick1_account))
                            elif nick2_account - chips2 < 0:
                                irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick2, nick2_account))
                            else:
                                take_chips_nick1 = nick1_account - chips1
                                take_chips_nick2 = nick2_account - chips2
                                self.oduzimanje_zetona(irc, nick1, take_chips_nick1, channel)
                                self.oduzimanje_zetona(irc, nick2, take_chips_nick2, channel)
                                numbers = random.sample(range(36), 2)
                                number1 = numbers[0]
                                number2 = numbers[1]
                                irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number1, nick1)))
                                irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number2, nick2)))
                        else:
                            irc.reply("Some of those players doesn't even have account yet.")
                    elif nick3 is not None and nick4 is None:
                        read_chips = self.citanje_zetona(channel)
                        if nick1 in read_chips.keys() and nick2 in read_chips.keys():
                            if nick3 in read_chips.keys():
                                nick1_account = read_chips[nick1]['zetoni']
                                nick2_account = read_chips[nick2]['zetoni']
                                nick3_account = read_chips[nick3]['zetoni']
                                if nick1_account - chips1 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick1, nick1_account))
                                elif nick2_account - chips2 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick2, nick2_account))
                                elif nick3_account - chips3 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick3, nick3_account))
                                else:
                                    take_chips_nick1 = nick1_account - chips1
                                    take_chips_nick2 = nick2_account - chips2
                                    take_chips_nick3 = nick3_account - chips3
                                    self.oduzimanje_zetona(irc, nick1, take_chips_nick1, channel)
                                    self.oduzimanje_zetona(irc, nick2, take_chips_nick2, channel)
                                    self.oduzimanje_zetona(irc, nick3, take_chips_nick3, channel)
                                    numbers = random.sample(range(36), 3)
                                    number1 = numbers[0]
                                    number2 = numbers[1]
                                    number3 = numbers[2]
                                    irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number1, nick1)))
                                    irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number2, nick2)))
                                    irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number3, nick3)))
                            else:
                                irc.reply("Some of those players doesn't even have account yet.")
                        else:
                            irc.reply("Some of those players doesn't even have account yet.")
                    elif nick4 is not None and nick5 is None:
                        read_chips = self.citanje_zetona(channel)
                        if nick1 in read_chips.keys() and nick2 in read_chips.keys():
                            if nick3 in read_chips.keys() and nick4 in read_chips.keys():
                                nick1_account = read_chips[nick1]['zetoni']
                                nick2_account = read_chips[nick2]['zetoni']
                                nick3_account = read_chips[nick3]['zetoni']
                                nick4_account = read_chips[nick4]['zetoni']
                                if nick1_account - chips1 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick1, nick1_account))
                                elif nick2_account - chips2 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick2, nick2_account))
                                elif nick3_account - chips3 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick3, nick3_account))
                                elif nick4_account - chips4 < 0:
                                    irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick4, nick4_account))
                                else:
                                    take_chips_nick1 = nick1_account - chips1
                                    take_chips_nick2 = nick2_account - chips2
                                    take_chips_nick3 = nick3_account - chips3
                                    take_chips_nick4 = nick4_account - chips4
                                    self.oduzimanje_zetona(irc, nick1, take_chips_nick1, channel)
                                    self.oduzimanje_zetona(irc, nick2, take_chips_nick2, channel)
                                    self.oduzimanje_zetona(irc, nick3, take_chips_nick3, channel)
                                    self.oduzimanje_zetona(irc, nick4, take_chips_nick4, channel)
                                    numbers = random.sample(range(36), 4)
                                    number1 = numbers[0]
                                    number2 = numbers[1]
                                    number3 = numbers[2]
                                    number4 = numbers[3]
                                    irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number1, nick1)))
                                    irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number2, nick2)))
                                    irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number3, nick3)))
                                    irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number4, nick4)))
                            else:
                                irc.reply("Some of those players doesn't even have account yet.")
                        else:
                            irc.reply("Some of those players doesn't even have account yet.")
                    elif nick5 is not None and chips5 is not None:
                        read_chips = self.citanje_zetona(channel)
                        if nick1 in read_chips.keys() and nick2 in read_chips.keys():
                            if nick3 in read_chips.keys() and nick4 in read_chips.keys():
                                if nick5 in read_chips.keys():
                                    nick1_account = read_chips[nick1]['zetoni']
                                    nick2_account = read_chips[nick2]['zetoni']
                                    nick3_account = read_chips[nick3]['zetoni']
                                    nick4_account = read_chips[nick4]['zetoni']
                                    nick5_account = read_chips[nick5]['zetoni']
                                    if nick1_account - chips1 < 0:
                                        irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick1, nick1_account))
                                    elif nick2_account - chips2 < 0:
                                        irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick2, nick2_account))
                                    elif nick3_account - chips3 < 0:
                                        irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick3, nick3_account))
                                    elif nick4_account - chips4 < 0:
                                        irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick4, nick4_account))
                                    elif nick5_account - chips5 < 0:
                                        irc.reply("\x02%s\x02 doesn't have enough chips for this bet. He has \x02%s\x02 chips in his account. Please start roulette again without this player or after he pays some credit." % (nick5, nick5_account))
                                    else:
                                        take_chips_nick1 = nick1_account - chips1
                                        take_chips_nick2 = nick2_account - chips2
                                        take_chips_nick3 = nick3_account - chips3
                                        take_chips_nick4 = nick4_account - chips4
                                        take_chips_nick5 = nick5_account - chips5
                                        self.oduzimanje_zetona(irc, nick1, take_chips_nick1, channel)
                                        self.oduzimanje_zetona(irc, nick2, take_chips_nick2, channel)
                                        self.oduzimanje_zetona(irc, nick3, take_chips_nick3, channel)
                                        self.oduzimanje_zetona(irc, nick4, take_chips_nick4, channel)
                                        self.oduzimanje_zetona(irc, nick5, take_chips_nick5, channel)
                                        numbers = random.sample(range(36), 5)
                                        number1 = numbers[0]
                                        number2 = numbers[1]
                                        number3 = numbers[2]
                                        number4 = numbers[3]
                                        number5 = numbers[4]
                                        irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number1, nick1)))
                                        irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number2, nick2)))
                                        irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number3, nick3)))
                                        irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number4, nick4)))
                                        irc.queueMsg(ircmsgs.action(channel, 'rolls number \x02%s\x02 for \x02%s\x02.' % (number5, nick5)))
                                else:
                                    irc.reply("Some of those players doesn't even have account yet.")
                            else:
                                irc.reply("Some of those players doesn't even have account yet.")
                        else:
                            irc.reply("Some of those players doesn't even have account yet.")
                else:
                    irc.reply("We don't have this game type yet, possible game types are: \x02color (c), high number (hn), small number (sn)\x02.")
            else:
                irc.reply("You can't start roulette because you're not OP.")
        else:
            irc.reply("This command is not available on this channel.")