执行此操作的命令,感谢任何帮助我的人
示例:
user: !say Hello
Bot: Hello
答案 0 :(得分:2)
要如何您要接受该信息。您是否只想接受a single word,而忽略多余的单词?
from discord.ext import commands
bot = commands.Bot(command_prefix='!')
@bot.command()
async def say(ctx, word):
await ctx.send(word)
您想接受any number of inputs,但要分开对待吗?
@bot.command()
async def longest(ctx, *words):
await ctx.send(max(words, key=len))
或者您想process the rest of the message as a single string(可能包含许多单词)
@bot.command()
async def echo(ctx, *, message):
await ctx.send(message)
答案 1 :(得分:0)
如果您想让漫游器重复作者的消息并删除原始消息,请尝试使用此命令:
@bot.command(pass_context=True)
async def say(ctx, *args):
mesg = ''.join(args)
await bot.delete_message(ctx.message)
return await bot.say(mesg)