utils.mdcmd: support files with no body
@@ -76,6 +76,10 @@ def parse_body(body_raw: str):
if current_header or current_body:
doadd()
+ # special case for an empty body
+ if not parts:
+ parts.append(('', ''))
+
return parts
@@ -101,7 +105,12 @@ def create_embed(header: 'Dict[str, str]', body: 'List[Tuple[str, str]]', embed_
def parse_md_command(md_text: str, format_map: dict, embed_color: discord.Color):
- header_raw, body_raw = md_text.split('\n\n', maxsplit=1)
+ #header_raw, body_raw = md_text.split('\n\n', maxsplit=1)
+ parts = md_text.split('\n\n', maxsplit=1)
+ if len(parts) == 1:
+ # in case there is no body
+ parts.append('')
+ header_raw, body_raw = parts
body_raw = body_raw.format_map(format_map)
