
Security News
PodRocket Podcast: Inside the Recent npm Supply Chain Attacks
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
@sfirew/mc-motd-parser
Advanced tools
Can convert minecraft server MOTD data to text, json, html, and clean tags.
Support 1.16 custom hex color, and auto check motd data type.
Don't have other dependencies.
The parser does not have the Minecraft font by default.
You can try server status view in my created service https://mcsv.top/server/mc.hypixel.net
choose your favorite package manager
# npm
$ npm install @sfirew/mc-motd-parser
# yarn
$ yarn add @sfirew/mc-motd-parser
# pnpm
$ pnpm add @sfirew/mc-motd-parser
const motdParser = require('@sfirew/mc-motd-parser');
import motdParser from '@sfirew/mc-motd-parser'
Some examples here, you can use TypeScript or JavaScript.
cleanTags(string)
clean text color tags.
let motdText = "§aHypixel Network §7§c1.8/1.9/1.10/1.11/1.12 §e§lNEW PTL GAME:§b§l THE BRIDGE";
let result = motdParser.cleanTags(motdText);
console.log(result);
/* result, callback Text:
* Hypixel Network 1.8/1.9/1.10/1.11/1.12 NEW PTL GAME: THE BRIDGE
*/
autoToHtml(string | object)
auto check MOTD data type then return same html result.
let jsonExample = {
"extra": [
{
"bold": true,
"color": "gold",
"text": "Viper "
},
{
"color": "gray",
"text": "┃ "
},
{
"color": "yellow",
"text": "Summer Sale"
},
{
"color": "white",
"text": " at "
},
{
"color": "gold",
"text": "store.vipermc.net\n"
},
{
"color": "gray",
"text": "► "
},
{
"color": "yellow",
"text": "EOTW "
},
{
"color": "white",
"text": "on "
},
{
"color": "gold",
"text": "Infernal"
},
{
"color": "white",
"text": " is this Thursday at "
},
{
"color": "yellow",
"text": "5PM ET"
},
{
"color": "white",
"text": "."
}
],
"text": ""
};
let autoJsonResult = motdParser.autoToHtml(jsonExample);
console.log(autoJsonResult);
/* auto JSON Result, callback HTML:
<span style="color: #FFAA00;font-weight: bold;">Viper </span><span style="color: #AAAAAA;">┃ </span><span style="color: #FFFF55;">Summer Sale</span><span style="color: #FFFFFF;"> at </span><span style="color: #FFAA00;">store.vipermc.net<br/></span><span style="color: #AAAAAA;">► </span><span style="color: #FFFF55;">EOTW </span><span style="color: #FFFFFF;">on </span><span style="color: #FFAA00;">Infernal</span><span style="color: #FFFFFF;"> is this Thursday at </span><span style="color: #FFFF55;">5PM ET</span><span style="color: #FFFFFF;">.</span>
*/
let textExample = "§aHypixel Network §7§c1.8/1.9/1.10/1.11/1.12 §e§lNEW PTL GAME:§b§l THE BRIDGE";
let autoTextResult = motdParser.autoToHtml(textExample);
console.log(autoTextResult);
/* auto Text Result, callback HTML:
<span style="color: #55FF55;">Hypixel Network <span style="color: #AAAAAA;"><span style="color: #FF5555;">1.8/1.9/1.10/1.11/1.12 <span style="color: #FFFF55;"><span style="font-weight: bold;">NEW PTL GAME:<span style="color: acqua;"><span style="font-weight: bold;"> THE BRIDGE</span></span></span></span></span></span></span>
*/
textToHTML(string)
convert motd text to html.
let motdText = "§aHypixel Network §7§c1.8/1.9/1.10/1.11/1.12 §e§lNEW PTL GAME:§b§l THE BRIDGE";
let result = motdParser.textToHTML(motdText);
console.log(result);
/* result, callback HTML:
* <span style="color: #55FF55;">Hypixel Network <span style="color: #AAAAAA;"><span style="color: #FF5555;">1.8/1.9/1.10/1.11/1.12 <span style="color: #FFFF55;"><span style="font-weight: bold;">NEW PTL GAME:<span style="color: acqua;"><span style="font-weight: bold;"> THE BRIDGE</span></span></span></span></span></span></span>
*/
textToJSON(string)
convert motd json to html.
let motdText = "§aHypixel Network §7§c1.8/1.9/1.10/1.11/1.12 §e§lNEW PTL GAME:§b§l THE BRIDGE";
let result = motdParser.textToJSON(motdText);
console.log(result);
/* result, callback JSON:
{
text: '',
extra: [
{ text: '', extra: [] },
{ text: 'Hypixel Network ', extra: [], color: '#55FF55' },
{ text: '', extra: [], color: '#AAAAAA' },
{ text: '1.8/1.9/1.10/1.11/1.12 ', extra: [], color: '#FF5555' },
{ text: '', extra: [], color: '#FFFF55' },
{ text: 'NEW PTL GAME:', extra: [], bold: true, color: '#FFFF55' },
{ text: '', extra: [], bold: true, color: '#55FFFF' },
{ text: ' THE BRIDGE', extra: [], bold: true, color: '#55FFFF' }
]
}
*/
JSONToHtml(object)
convert text to motd json.
let mcfalloutJson = {
"extra": [
{
"color": "gray",
"text": " "
},
{
"color": "gold",
"text": "廢土伺服器 "
},
{
"color": "white",
"text": "mcFallout.net"
},
{
"color": "dark_gray",
"text": " - "
},
{
"color": "gray",
"text": "版本 1.17.1 "
},
{
"color": "gold",
"text": "洞穴"
},
{
"color": "light_purple",
"text": "與"
},
{
"color": "aqua",
"text": "山崖\n"
},
{
"color": "gray",
"text": " "
},
{
"color": "dark_gray",
"text": "享受工廠、農場、建築與紅石"
}
],
"text": ""
}
let result = motdParser.JSONToHtml(mcfalloutJson);
console.log(result)
/* result, callback HTML:
<span style="color: #AAAAAA;"> </span><span style="color: #FFAA00;">廢土伺服器 </span><span style="color: #FFFFFF;">mcFallout.net</span><span style="color: #555555;"> - </span><span style="color: #AAAAAA;">版本 1.17.1 </span><span style="color: #FFAA00;">洞穴</span><span style="color: #FF55FF;">與</span><span style="color: #55FFFF;">山崖<br/></span><span style="color: #AAAAAA;"> </span><span style="color: #555555;">享受工廠、農場、建築與紅石</span>
*/
FAQs
Minecraft Server MOTD Parser, can convert to html, json, text.
The npm package @sfirew/mc-motd-parser receives a total of 5 weekly downloads. As such, @sfirew/mc-motd-parser popularity was classified as not popular.
We found that @sfirew/mc-motd-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.