Discord.py(Change bot#39;s text color)(Discord.py(更改机器人的文本颜色))
问题描述
我已经搜索了网络,但没有找到答案.
I have searched the web but found no answer.
我为我的不和谐机器人创建了一个嵌入,我知道如何设置左侧栏的颜色,但我如何更改机器人发送的文本的颜色?
I created an embed for my discord bot and i know how to set the color of the bar on the left but how can i change the color of the text the bot sends?
推荐答案
我能找到的唯一解决方案(之前也有同样的问题)是使用语法突出显示
The only solution I've been able to find for this (have had the same question before) was using syntax highlighting
```css
green text
```
您可以在此 github gist
希望对您有所帮助,我不知道任何其他真正颜色"的解决方案.不使用语法高亮的文本.
Hope it helps, I don't know about any other solution to really "color" texts without using syntax highlighting.
更新:关于OP的评论.
UPDATE: Regarding comment from OP.
这是我能够将其包含到嵌入中的一种方式.
This was a way I've been able to include it into an embed.
async def test(ctx, *args):
retStr = str("""```css
This is some colored Text```""")
embed = discord.Embed(title="Random test")
embed.add_field(name="Name field can't be colored as it seems",value=retStr)
await ctx.send(embed=embed)
制作了这个:
没有嵌入:
async def test(ctx, *args):
retStr = str("""```css
This is some colored Text```""")
await ctx.send(retStr)
制作了这个:
在您选择的语言之后写一个新行
很重要,否则它无法识别语言声明
It is important to write a new line
after the language you choose for syntax highlighting otherwise it doesn't recognize it language declaration
这篇关于Discord.py(更改机器人的文本颜色)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:Discord.py(更改机器人的文本颜色)
基础教程推荐
- numpy float:比算术运算中内置的慢 10 倍? 2022-01-01
- pyserial - 可以从线程 a 写入串行端口,是否阻塞从线程 b 读取? 2022-01-01
- 用 Python 编写 Fortran 无格式文件 2022-01-01
- 在 Celery 工作人员中捕获 Heroku SIGTERM 以优雅地关 2022-01-01
- 与常规 dict 相比,Python manager.dict() 非常慢 2022-01-01
- 由Python将MP3转换为MIDI(类型错误:无法加载插件:mtg-Melodia:Melodia) 2022-01-01
- 将 x 轴刻度更改为自定义字符串 2022-01-01
- 使用生成器和迭代器时 Python 多循环失败 2022-01-01
- Discord.py 缺少必需的参数 2022-01-01
- 尝试制作WhatsApp机器人 2022-01-01
