1.0.8 • Published 2 years ago

motd-parser v1.0.8

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

motd-parser

Easily parse Minecraft MOTDs

This package was written to parse MOTDs retrieved by minecraft-server-util

Usage

const motdParser = require("motd-parser")("1.17");

// data from 'minecraft-server-util'
const data = {
  description: {
    descriptionText:
      "§5§lWouterK12's Server!§r\n§3§o§lSurvival on §l§n§a[1.17]§r§3§o§l !",
  },
};

console.log(motdParser.toClean(data));
// [ "WouterK12's Server!", 'Survival on [1.17] !' ]

// or enter a MOTD as string
const motd =
  "§5§lWouterK12's Server!§r\n§3§o§lSurvival on §l§n§a[1.17]§r§3§o§l !";

console.log(motdParser.toClean(motd));
// [ "WouterK12's Server!", 'Survival on [1.17] !' ]

API

data retrieved by minecraft-server-util
Or a MOTD as string, as shown in the example above

toRaw(data)

Returns MOTD as an array

toClean(data)

Returns MOTD as an array, without color codes

toHTML(data, noStyles)

Returns MOTD as HTML

  • noStyles - (optional) - Don't apply inline CSS styles
1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago