diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a8f3f7..d0d639f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [Unreleased] +### Fixed +- Issue where ?morse/?demorse outputs beginning with `-` rendered as a bulleted list (#484). ## [2.9.2] - 2023-12-15 ### Added diff --git a/exts/morse.py b/exts/morse.py index 641912b..b98f123 100644 --- a/exts/morse.py +++ b/exts/morse.py @@ -25,13 +25,14 @@ def __init__(self, bot: commands.Bot): @commands.command(name="morse", aliases=["cw"], category=cmn.Cats.CODES) async def _morse(self, ctx: commands.Context, *, msg: str): """Converts ASCII to international morse code.""" - result = "" + result = "`" for char in msg.upper(): try: result += self.morse[char] except KeyError: result += "" result += " " + result += "`" embed = cmn.embed_factory(ctx) embed.title = f"Morse Code for {msg}" embed.description = "**" + result + "**" @@ -52,6 +53,9 @@ async def _unmorse(self, ctx: commands.Context, *, msg: str): except KeyError: result += "" result += " " + if len(result) > 0 and result[0] == "-": + # escape markdown bullet + result = "\\" + result embed = cmn.embed_factory(ctx) embed.title = f"ASCII for {msg0}" embed.description = result