如何在python中获取命令用法

时间:2018-07-04 08:38:33

标签: python-3.x discord.py

如何从已安装的所有服务器bot中获取命令使用历史记录。我在Google搜索中找不到任何示例代码。

So for an example if we type !commands_stats

Bot reply's with {members.name} from {server.name} used !hello command.

按所有服务器中使用的前10或xx个命令列出该应用。

否则,如果任何成员在任何服务器中使用命令,它都应为所提及服务器的指定通道ID发送确认消息。

So for an example if a member from any server type !hello in channel.
after bot reply to that message it should send a confirmation to listed Server ID and Channel ID like below.

Bot reply's with {members.name} from {server.name} used !hello command.

1 个答案:

答案 0 :(得分:0)

documentation

是Message类的一种实现方法
client = Botcommand_prefix=("!")

@client.command(pass_context = True)
async def hello(ctx):
    await client.say("Hi") 
    print(f"{ctx.message.author.name} from {ctx.message.server} used !hello command")

您可以使用这些参数将值添加到包含所有命令的字典中