def do_command(self, e, cmd):
        self.activated = True
        logger.debug('Received command: %s', cmd)
        nickname = e.source.nick
        if nickname not in self.limit_access_to:
            self.send_user_message(
                nickname,
                "I'm sorry, %s, you are not allowed to give commands "
                "to this debugger." % (
                    nickname,
                )
            )
            return

        if cmd.startswith("!allow"):
            allows = cmd.split(' ')
            usernames = allows[1:]
            if not self.limit_access_to:
                self.limit_access_to.append(nickname)
            self.limit_access_to.extend(usernames)
            self.send_channel_message(
                "The following users have been granted access to the debugger:"
                " %s." % (
                    ', '.join(usernames)
                )
            )
        elif cmd.startswith("!forbid"):
            forbids = cmd.split(' ')
            usernames = forbids[1:]
            try:
                for username in usernames:
                    self.limit_access_to.remove(username)
                self.send_channel_message(
                    "The following users have been forbidden access to the "
                    "debugger: %s." % (
                        ', '.join(usernames)
                    )
                )
            except ValueError:
                self.send_channel_message(
                    "The users %s are not in the 'allows' list.  You must "
                    "have a defined 'allows' list to remove users from it." % (
                        ', '.join(usernames)
                    )
                )
            if not self.limit_access_to:
                self.send_channel_message(
                    "No users are allowed to interact with the debugger; "
                    "continuing from breakpoint."
                )
                self.queue.put('continue')

        elif cmd.startswith("!set_dpaste_minimum_response_length"):
            value = cmd.split(' ')
            try:
                self.dpaste_minimum_response_length = int(value[1])
                self.send_channel_message(
                    "Messages longer than %s lines will now be posted "
                    "to dpaste if possible." % (
                        self.dpaste_minimum_response_length
                    )
                )
            except (TypeError, IndexError, __HOLE__):
                self.send_channel_message(
                    "An error was encountered while setting the "
                    "dpaste_minimum_response_length setting. %s"
                )
        elif cmd.startswith("!set_message_wait_seconds"):
            value = cmd.split(' ')
            try:
                self.message_wait_seconds = float(value[1])
                self.send_channel_message(
                    "There will be a delay of %s seconds between "
                    "sending each message." % (
                        self.message_wait_seconds
                    )
                )
            except (TypeError, IndexError, ValueError):
                self.send_channel_message(
                    "An error was encountered while setting the "
                    "message_wait_seconds setting."
                )
        elif cmd.startswith("!help"):
            available_commands = textwrap.dedent("""
                Available Commands:
                * !!allow NICKNAME
                  Add NICKNAME to the list of users that are allowed to
                  interact with the debugger. Current value: {limit_access_to}.

                * !!forbid NICKNAME
                  Remove NICKNAME from the list of users that are allowed
                  to interact with the debugger.

                * !!set_dpaste_minimum_response_length INTEGER
                  Try to send messages this length or longer in lines
                  to dpaste rather than sending them to IRC directly.
                  Current value: {dpaste_minimum_response_length}.

                * !!set_message_wait_seconds FLOAT
                  Set the number of seconds to wait between sending messages
                  (this is a measure used to prevent being kicked from
                  Freenode and other IRC servers that enforce limits on the
                  number of messages a client an send in a given period of
                  time. Current value: {message_wait_seconds}.
            """.format(
                limit_access_to=self.limit_access_to,
                dpaste_minimum_response_length=(
                    self.dpaste_minimum_response_length
                ),
                message_wait_seconds=self.message_wait_seconds,
            ))
            self.send_channel_message(
                available_commands,
                dpaste=True,
            )
        else:
            self.queue.put(cmd.strip())
dataset/ETHPy150Open coddingtonbear/ircpdb/ircpdb/bot.py/IrcpdbBot.do_command