Esempio n. 1
0
    def __init__(self, instigator, victim, reason):
        self.protocol = protocol = instigator.protocol
        self.instigator = instigator
        self.victim = victim
        self.reason = reason
        self.votes = {instigator: True}
        self.ended = False

        protocol.irc_say(
            S_ANNOUNCE_IRC.format(instigator=instigator.name,
                                  instigator_id=instigator.player_id,
                                  victim=victim.name,
                                  victim_id=victim.player_id,
                                  reason=self.reason))
        protocol.send_chat(S_ANNOUNCE.format(
            instigator=instigator.name,
            instigator_id=instigator.player_id,
            victim=victim.name,
            victim_id=victim.player_id),
                           sender=instigator)
        protocol.send_chat(S_REASON.format(reason=self.reason),
                           sender=instigator)
        instigator.send_chat(
            S_ANNOUNCE_SELF.format(victim=victim.name,
                                   victim_id=victim.player_id))

        schedule = Scheduler(protocol)
        schedule.call_later(self.timeout, self.end, S_RESULT_TIMED_OUT)
        schedule.loop_call(30.0, self.send_chat_update)
        self.schedule = schedule
Esempio n. 2
0
    def __init__(self, player, time=300, reason='None'):
        if time == 0:
            player.mute = True
            player.protocol.send_chat(
                '%s was muted indefinitely (Reason: %s)' %
                (player.name, reason),
                irc=True)
            return

        schedule = Scheduler(player.protocol)
        schedule.call_later(time, self.end)
        player.mute_schedule = schedule

        player.protocol.send_chat('%s was muted for %s seconds (Reason: %s)' %
                                  (player.name, time, reason),
                                  irc=True)
        player.mute = True

        self.player = player
        self.time = time