mojira / mojira-discord-bot

🎮 A Discord bot for linking to and providing information about Mojira tickets
https://discord.gg/rpCyfKV
GNU General Public License v3.0
19 stars 9 forks source link

Fix embed generation failing with double header #287

Closed dericksonmark closed 10 months ago

dericksonmark commented 10 months ago

Purpose

An issue with at least two header lines at the start of its description fails to produce an embed. For example, the following description would result in an error message when requesting its embed:

### The bug
#### Part 1
...

This is because MojiraBot removes the first header, and takes everything between where it was and the next header. With a double header, there is no content to consider, and an empty description is used as the embed's description. Discord.js does not accept an empty string for this value for some reason.

Approach

If the description is the empty string, replace it with null, as this is accepted.