如何让机器人准确响应您在 discord.py 中所说的内容
How to make a bot respond exactly what you say in discord.py
我试图让我的 Discord 机器人通过 !say 命令准确地说出我想要的内容,不包括 !say 部分,但我是编码新手,不知道从哪里开始。我知道制作机器人 say/react/delete/DM 消息的基础知识,仅此而已
试试这个:
@commands.command()
async def say(self, ctx, *, arg):
await ctx.send(arg)
完整代码如下所示:
from discord.ext import commands
bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())
@bot.event
async def on_ready():
print("bot is ready")
@commands.command()
async def say(self, ctx, *, arg):
await ctx.send(arg)
bot.run("YOURTOKEN")
我试图让我的 Discord 机器人通过 !say 命令准确地说出我想要的内容,不包括 !say 部分,但我是编码新手,不知道从哪里开始。我知道制作机器人 say/react/delete/DM 消息的基础知识,仅此而已
试试这个:
@commands.command()
async def say(self, ctx, *, arg):
await ctx.send(arg)
完整代码如下所示:
from discord.ext import commands
bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())
@bot.event
async def on_ready():
print("bot is ready")
@commands.command()
async def say(self, ctx, *, arg):
await ctx.send(arg)
bot.run("YOURTOKEN")