Python 如何让discord机器人在命令中提到我和我提到的人

Python 如何让discord机器人在命令中提到我和我提到的人,python,discord,Python,Discord,我的意思的例子(“+slap@examplename”)然后机器人会在聊天中加入“@me slapped@examplename”我似乎无法让它工作 import discord from discord.ext.commands import Bot bot = Bot(command_prefix='+') bot.command() async def slap(self, member : discord.Member): """<member>: Be

我的意思的例子(“+slap@examplename”)然后机器人会在聊天中加入“@me slapped@examplename”我似乎无法让它工作

import discord
from discord.ext.commands import Bot

bot = Bot(command_prefix='+')

bot.command()
async def slap(self, member : discord.Member):
        """<member>: Be careful with this one."""
        await self.bot.say("*slaps {0} around a bit with a large, girthy trout*".format(member))


@bot.event
async def on_ready():
        print ("------------------------------------")
        print ("Bot Name: " + bot.user.name)
        print ("Bot ID: " + bot.user.id)
        print ("Discord Version: " + discord.__version__)
        print ("------------------------------------")
        await bot.change_presence(game=discord.Game(name='Created By Pluto'))


bot.run('')
导入不一致
从discord.ext.commands导入Bot
bot=bot(命令前缀='+')
bot.command()
异步def slap(self,成员:discord.member):
“:小心这个。”
等待self.bot.say(“*用一条大的、带环的鳟鱼*拍打{0}一点。”。格式(成员))
@机器人事件
_ready()上的异步定义:
打印(“---------------------------------------”)
打印(“机器人名称:”+Bot.user.Name)
打印(“机器人ID:+Bot.user.ID”)
打印(“不协调版本:+Discord.\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
打印(“---------------------------------------”)
等待机器人。改变你的状态(game=discord.game(name='Created By Pluto'))
bot.run(“”)

我已经删除了
self
,因为您似乎没有使用齿轮:

bot.command(pass_context=True)
async def slap(member: discord.Member):
        """<member>: Be careful with this one."""
        await bot.say("{} slaps {}".format(ctx.message.author.mention, member.mention))
bot.command(pass\u context=True)
异步def slap(成员:discord.member):
“:小心这个。”
等待bot.say(“{}slaps{}”。格式(ctx.message.author.title,member.title))
Member
对象(包括
message.author
)具有
提及
属性,允许您轻松提及它们