【问题标题】:discord ASCII bot python characters aren't all the same length so it looks baddiscord ASCII bot python字符的长度不一样,所以看起来很糟糕
【发布时间】:2021-02-13 06:41:25
【问题描述】:

因此制作了一个简单的不和谐机器人,为用户提供横幅命令 ' @commands.Cog.listener() async def on_ready(self): print('Dictbot 运行流畅')

@commands.command()
async def banner(self, ctx, *, msg):
    ascii_banner = self.cus_fig.renderText(msg) 
    discord_banner = ''
    for charecter in ascii_banner:
        discord_banner += charecter
        if (charecter == ' '):
            discord_banner += '  '
        
    print(ascii_banner)
    await ctx.send(discord_banner)

@commands.command()
async def font(self, ctx, *, fontName):
    self.cus_fig = Figlet(font=fontName)

我使用了 pyfiglet,当我将艺术打印到终端时才可以找到它,但不和谐的是,并非所有字符的宽度都相同,所以它看起来超级难看。我做了一个临时修复,将所有单个空格变成 3 个空格,这可以正常工作,但字母略有偏差。而且我只能使用只有磅和空格的banner3字体。他们有什么方法可以使所有角色的距离不和谐吗?或者更好的方式来做我正在做的事情

【问题讨论】:

    标签: python discord ascii-art


    【解决方案1】:

    我也有同样的问题。 似乎将文本放在代码块中(在开头和结尾都有```)固定每个字符的宽度。 您也可以尝试用“⠀”字符替换空格。

    【讨论】:

    • 当你获得 50 声望时,记得使用 cmets 来获得此类提示。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-12-03
    • 1970-01-01
    • 2013-08-24
    • 2019-07-29
    相关资源
    最近更新 更多