繁体   English   中英

Discord.py 将消息转换为字符串的程序

[英]Discord.py program to convert a message to string

这是我的第一个问题。 我正在编写一个 python discord 机器人,我想将任何用户的消息转换为字符串,就像有人输入一样,

你好呀!

然后机器人会将消息转换为字符串。

我自己尝试过(通过从 inte.net 获取 jelp)。 我写,

if message.content=='test':
   text=message.content
   await message.channel.send(text)

但每当我输入“测试”时,它都会发送

隐姓埋名先生测试

在这里Mr. Incognito是我的名字。 我不想让我的名字出现在前面。 我只想显示test词。

谁能解决我的问题?

import discord
from discord.ext import commands

client = commands.Bot(command_prefix = '!')

@client.command()
async def equal(ctx, message):
  await ctx.send(message)

client.run('PUTYOURTOKENHERE')

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM