Line separator/break in discord embded

寵の児 提交于 2020-05-12 11:11:55

问题


I have the following discord embed:

    message.reply({
    content: '',
    embed: {
        color: 11416728,
        author: {
            name: 'xx know-it-all',
            icon_url: 'https://xx.png'
        },
        description: '',
        footer: {
            icon_url: client.user.avatarURL,
            text: '© xx Network'
        },
        fields: [
            {
                name: '1st Line',
                value: '2nd Line',
            },
            {
                name: 'MAKE THIS JUST A SPACER',
                value: 'MAKE THIS JUST A SPACER',
            },
            {
                name: '5th Line',
                value: '6th Line',
            }
        ]
    }
})

I am trying to figure out how to create a spacer of sorts. I have tried using a html space, blank space, and alt code space. None of them seem to work. Any ideas on how to accomplish this?

The issue is discord is returning the field as null, so it's not taking it when I use the invisible html space or putting \n


回答1:


I got it!

All I needed to do was use the C/C++/Java encoding version of the invisible space

\u200B

Reference: https://www.fileformat.info/info/unicode/char/200B/index.htm

This can come into use for other people looking to make embeds look more clear as discord complicates it




回答2:


Discord.JS has a method .addEmptyField() that uses \u200B to display a empty line.

    message.reply({
    content: '',
    embed: {
        color: 11416728,
        author: {
            name: 'xx know-it-all',
            icon_url: 'https://xx.png'
        },
        description: '',
        footer: {
            icon_url: client.user.avatarURL,
            text: '© xx Network'
        },
        fields: [
            {
                name: '1st Line',
                value: '2nd Line',
            },
            {
                name: '\u200B',
                value: '\u200B',
            },
            {
                name: '5th Line',
                value: '6th Line',
            }
        ]
    }
})

Appears to be working here.



来源:https://stackoverflow.com/questions/50373020/line-separator-break-in-discord-embded

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!