@lunibee/formatters
The @lunibee/formatters package provides small, dependency-free helpers for creating Discord mentions, timestamps, and markdown text.
Installation
Section titled “Installation”bun add @lunibee/formattersMentions
Section titled “Mentions”import { userMention, channelMention, roleMention,} from "@lunibee/formatters";
console.log(userMention("123456789012345678"));console.log(channelMention("123456789012345678"));console.log(roleMention("123456789012345678"));Use these helpers instead of manually assembling mention strings when you already have a Discord ID.
Discord Timestamps
Section titled “Discord Timestamps”import { timestamp } from "@lunibee/formatters";
const now = Math.floor(Date.now() / 1000); // Unix seconds
console.log(timestamp(now));console.log(timestamp(now, "R"));console.log(timestamp(now, "F"));Discord renders the timestamp according to each user’s locale and timezone.
Markdown Helpers
Section titled “Markdown Helpers”The formatter package also provides helpers for common Discord markdown styles: bold, italic, underline, strikethrough, spoiler, inlineCode, codeBlock, link, blockQuote, heading, subtext, orderedList, bulletList and escapeMarkdown. Prefer these when building long messages dynamically so formatting stays readable in your source code.
Putting it together
Section titled “Putting it together”await channel.send({ content: `${userMention(userId)} — your ticket was created ${timestamp(Math.floor(Date.now() / 1000), "R")}.`,});