Exemplo n.º 1
0
    def tell(cls, msg, recipient, **kwargs):
        """Send a tell (private message) to someone.

        :param msg: The message to be sent.
        :type msg: str
        :param recipient: The player that should receive the message.
        :type recipient: str/int/minqlx.Player
        :returns: bool -- True if succeeded, False otherwise.
        :raises: ValueError
        """
        minqlx.TellChannel(recipient).reply(msg, **kwargs)
Exemplo n.º 2
0
    def cmd_servers(self, player, msg, channel):
        """If `qlx_servers` is set then it outputs status of servers.
        Outputs to chat if `qlx_serversShowInChat` is 1, otherwise it will
        output to the player who called the command only."""
        servers = self.get_cvar("qlx_servers", list)
        if len(servers) == 1 and servers[0] == "":
            self.logger.warning("qlx_servers is not set")
            player.tell("qlx_servers is not set")
            return minqlx.RET_STOP_ALL
        elif any(s == '' for s in servers):
            self.logger.warning(
                "qlx_servers has an invalid server(empty string). Most likely due to trailing comma."
            )
            player.tell(
                "qlx_servers has an invalid server(empty string). Most likely due to trailing comma."
            )
            return minqlx.RET_STOP_ALL

        irc = isinstance(player, minqlx.AbstractDummyPlayer)
        if not self.get_cvar("qlx_serversShowInChat", bool) and not irc:
            self.get_servers(servers, minqlx.TellChannel(player))
            return minqlx.RET_STOP_ALL

        self.get_servers(servers, channel, irc=irc)
Exemplo n.º 3
0
 def channel(self):
     return minqlx.TellChannel(self)