← Developer guides

Discord message bodies

Convert a Markdown reply into Discord API content. The generated allowed_mentions field disables automatic parsing of mentions.

Installation guide · Examples tested with 0.3.1

Result

The message body contains “Hello @everyone” and an empty allowed_mentions.parse array. Keep that setting when sending the message to prevent the text from notifying everyone.

Code examples

  • TypeScript
  • Python
  • Go

TypeScript

import { toMessages } from "mdto-messages";

const batch = toMessages("Hello @everyone", "discord");
console.log(batch.messages);

Python

from mdto_messages import to_messages

batch = to_messages("Hello @everyone", "discord")
print(batch.messages)

Go

package main

import (
    "fmt"
    "log"

    "github.com/jmeinke/mdto-messages"
)

func main() {
    batch, err := mdto.ToMessages("Hello @everyone", mdto.Discord)
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(batch.Messages)
}

References

  • Original example and platform reference
  • API reference and limits

Source: mdto-messages 0.3.1 · MIT license