使用 discord.ext.commands,我如何让机器人发送自己的用户名? python3
using discord.ext.commands, how would I make a bot send its own username? python3
我不明白如何让我的机器人发送它自己的用户名。我在想这样的事情:
@commands.command
async def sendname(self,ctx):
await ctx.send("I don't know what I would put here")
如果有人知道解决方法请告诉我。
您可以使用 client.user
或 bot.user
[取决于您如何定义 discord.Bot]。
@commands.command
async def sendname(self,ctx):
await ctx.send(client.user.name)
我不明白如何让我的机器人发送它自己的用户名。我在想这样的事情:
@commands.command
async def sendname(self,ctx):
await ctx.send("I don't know what I would put here")
如果有人知道解决方法请告诉我。
您可以使用 client.user
或 bot.user
[取决于您如何定义 discord.Bot]。
@commands.command
async def sendname(self,ctx):
await ctx.send(client.user.name)