client.say和client.send_message有什么区别?

时间:2019-01-27 02:01:05

标签: python python-3.x discord.py

标题很好地传达了这个问题。 client.say和client.send_message有什么区别?我什么时候应该使用两者中的任何一个?

1 个答案:

答案 0 :(得分:0)

github repo say的名称上实际上只是send_message,它从调用它的命令中自动获取目的地。

所以client.say只能在@client.command()内使用

def say(self, *args, **kwargs):
        """|coro|
        A helper function that is equivalent to doing
        .. code-block:: python
            self.send_message(message.channel, *args, **kwargs)
        The following keyword arguments are "extensions" that augment the
        behaviour of the standard wrapped call.
        Parameters
        ------------
        delete_after: float
            Number of seconds to wait before automatically deleting the
            message.
        See Also
        ---------
        :meth:`Client.send_message`
        """
        destination = _get_variable('_internal_channel')

        extensions = ('delete_after',)
        params = {
            k: kwargs.pop(k, None) for k in extensions
        }

        coro = self.send_message(destination, *args, **kwargs)
        return self._augmented_msg(coro, **params)