{"id":15914682,"url":"https://github.com/snowfirewolf/minecraft-motd-parser","last_synced_at":"2025-03-23T01:31:33.529Z","repository":{"id":40596115,"uuid":"395370136","full_name":"SnowFireWolf/minecraft-motd-parser","owner":"SnowFireWolf","description":"The Minecraft Server MOTD Parser","archived":false,"fork":false,"pushed_at":"2024-02-24T03:20:50.000Z","size":187,"stargazers_count":20,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-04-24T14:37:33.515Z","etag":null,"topics":["javascript","minecraft","motd","nodejs","parser","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@sfirew/minecraft-motd-parser","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SnowFireWolf.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2021-08-12T15:49:34.000Z","updated_at":"2024-04-11T17:55:54.000Z","dependencies_parsed_at":"2024-02-24T04:23:31.876Z","dependency_job_id":"28865274-f318-4c4b-9bdd-120370cf3b54","html_url":"https://github.com/SnowFireWolf/minecraft-motd-parser","commit_stats":{"total_commits":87,"total_committers":2,"mean_commits":43.5,"dds":0.08045977011494254,"last_synced_commit":"b9d0b90ac93b8632422dd4fc30a5bca754bd72ed"},"previous_names":[],"tags_count":16,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SnowFireWolf%2Fminecraft-motd-parser","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SnowFireWolf%2Fminecraft-motd-parser/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SnowFireWolf%2Fminecraft-motd-parser/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SnowFireWolf%2Fminecraft-motd-parser/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SnowFireWolf","download_url":"https://codeload.github.com/SnowFireWolf/minecraft-motd-parser/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245043990,"owners_count":20551861,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["javascript","minecraft","motd","nodejs","parser","typescript"],"created_at":"2024-10-06T17:05:17.340Z","updated_at":"2025-03-23T01:31:33.155Z","avatar_url":"https://github.com/SnowFireWolf.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Minecraft Server MOTD Parser\n![Version](https://img.shields.io/github/languages/top/SnowFireWolf/minecraft-motd-parser?style=for-the-badge)\n[![npm version](https://img.shields.io/npm/v/@sfirew/minecraft-motd-parser?label=version\u0026style=for-the-badge)](https://www.npmjs.com/package/@sfirew/minecraft-motd-parser?style=for-the-badge)\n[![License](https://img.shields.io/npm/l/minecraft-server-util?style=for-the-badge)](https://github.com/SnowFireWolf/minecraft-motd-parser/blob/master/LICENSE)\n![npm weekly downloads](https://img.shields.io/npm/dw/@sfirew/minecraft-motd-parser?style=for-the-badge)\n\n\n\n## Introduction\nThis package support **CommonJS**, **ES Module**, and **tree shaking**\n\nCan convert minecraft server MOTD data to text, json, html, and clean codes.\n\nSupport **1.16** custom **hex color**, and auto check motd data type.\n\nDon't have other dependencies.\n\n\n\n## Installation\nchoose your favorite package manager\n```bash\n# npm\n$ npm install @sfirew/minecraft-motd-parser\n\n# yarn\n$ yarn add @sfirew/minecraft-motd-parser\n\n# pnpm\n$ pnpm add @sfirew/minecraft-motd-parser\n```\n\n\n\n## Usage\n### CommonJS\n```typescript\nconst { autoToHTML } = require('@sfirew/minecraft-motd-parser');\n```\n\n### ES6 Modules\n```typescript\nimport { autoToHTML } from '@sfirew/minecraft-motd-parser'\n```\n\n### Simple use example\n```typescript\nimport { autoToHTML as motdParser } from '@sfirew/minecraft-motd-parser'\n// or \nimport motdParser from '@sfirew/minecraft-motd-parser'\n// motdParser.autoToHTML('motdString...');\n\nconst hypixelMotdString = \"§aHypixel Network §7§c1.8/1.9/1.10/1.11/1.12 §e§lNEW PTL GAME:§b§l THE BRIDGE\";\n\nconsole.log(motdParser(hypixelMotdString));\n\n/* result\n\u003cspan style=\"color:#55FF55;\"\u003eHypixel Network \u003c/span\u003e\u003cspan style=\"color:#FF5555;\"\u003e1.8/1.9/1.10/1.11/1.12 \u003c/span\u003e\u003cspan style=\"color:#FFFF55;font-weight: bold;\"\u003eNEW PTL GAME:\u003c/span\u003e\u003cspan style=\"color:#55FFFF;font-weight: bold;\"\u003e THE BRIDGE\u003c/span\u003e\n*/\n```\n\n\n### Some good custom motd hex color servers\nThe parser does not have the Minecraft font by default.\n\n#### Minecraft font example\n![Image_2022_01_2022d-2022h_58___002](https://user-images.githubusercontent.com/14024836/149810729-71909ca5-5705-43cf-ab3c-bdd66db00b78.png)\n\n![Image_2022_01_2022d-2022h_00___004](https://user-images.githubusercontent.com/14024836/149811040-5ddc35a0-38cf-4434-856a-968c94a4d6b4.png)\n\n#### No Minecraft font\n![Image_2022_01_2022d-2022h_04___003](https://user-images.githubusercontent.com/14024836/149811501-d1376d90-d9ad-4092-912a-de1f78fa42eb.png)\n\n![Image_2022_01_2022d-2022h_01___002](https://user-images.githubusercontent.com/14024836/149811151-d9270d63-aead-46f9-b496-c88eb3b00c72.png)\n\n\nYou can try server status view in my created service\n[https://mcsv.top/server/mc.hypixel.net](https://mcsv.top/server/mc.hypixel.net)\n\n\n\n## Example and main formatter\nSome examples here, you can use **TypeScript** or **JavaScript**.\n\n\n\n### `autoToHTML(string | object)`\nauto check MOTD data type then return same html result.\n\n```typescript\nimport motdParser from '@sfirew/minecraft-motd-parser'\n\nlet jsonExample = {\n  \"extra\": [\n    {\n      \"bold\": true,\n      \"color\": \"gold\",\n      \"text\": \"Viper \"\n    },\n    {\n      \"color\": \"gray\",\n      \"text\": \"┃ \"\n    },\n    {\n      \"color\": \"yellow\",\n      \"text\": \"Summer Sale\"\n    },\n    {\n      \"color\": \"white\",\n      \"text\": \" at \"\n    },\n    {\n      \"color\": \"gold\",\n      \"text\": \"store.vipermc.net\\n\"\n    },\n    {\n      \"color\": \"gray\",\n      \"text\": \"► \"\n    },\n    {\n      \"color\": \"yellow\",\n      \"text\": \"EOTW \"\n    },\n    {\n      \"color\": \"white\",\n      \"text\": \"on \"\n    },\n    {\n      \"color\": \"gold\",\n      \"text\": \"Infernal\"\n    },\n    {\n      \"color\": \"white\",\n      \"text\": \" is this Thursday at \"\n    },\n    {\n      \"color\": \"yellow\",\n      \"text\": \"5PM ET\"\n    },\n    {\n      \"color\": \"white\",\n      \"text\": \".\"\n    }\n  ],\n  \"text\": \"\"\n};\nlet autoJsonResult = motdParser.autoToHTML(jsonExample);\nconsole.log(autoJsonResult);\n\n/* auto JSON Result, callback HTML:\n\u003cspan style=\"color: #FFAA00;font-weight: bold;\"\u003eViper \u003c/span\u003e\u003cspan style=\"color: #AAAAAA;\"\u003e┃ \u003c/span\u003e\u003cspan style=\"color: #FFFF55;\"\u003eSummer Sale\u003c/span\u003e\u003cspan style=\"color: #FFFFFF;\"\u003e at \u003c/span\u003e\u003cspan style=\"color: #FFAA00;\"\u003estore.vipermc.net\u003cbr/\u003e\u003c/span\u003e\u003cspan style=\"color: #AAAAAA;\"\u003e► \u003c/span\u003e\u003cspan style=\"color: #FFFF55;\"\u003eEOTW \u003c/span\u003e\u003cspan style=\"color: #FFFFFF;\"\u003eon \u003c/span\u003e\u003cspan style=\"color: #FFAA00;\"\u003eInfernal\u003c/span\u003e\u003cspan style=\"color: #FFFFFF;\"\u003e is this Thursday at \u003c/span\u003e\u003cspan style=\"color: #FFFF55;\"\u003e5PM ET\u003c/span\u003e\u003cspan style=\"color: #FFFFFF;\"\u003e.\u003c/span\u003e\n*/\n\nlet textExample = \"§aHypixel Network §7§c1.8/1.9/1.10/1.11/1.12 §e§lNEW PTL GAME:§b§l THE BRIDGE\";\nlet autoTextResult = motdParser.autoToHTML(textExample);\nconsole.log(autoTextResult);\n\n/* auto Text Result, callback HTML:\n\u003cspan style=\"color: #55FF55;\"\u003eHypixel Network \u003cspan style=\"color: #AAAAAA;\"\u003e\u003cspan style=\"color: #FF5555;\"\u003e1.8/1.9/1.10/1.11/1.12 \u003cspan style=\"color: #FFFF55;\"\u003e\u003cspan style=\"font-weight: bold;\"\u003eNEW PTL GAME:\u003cspan style=\"color: acqua;\"\u003e\u003cspan style=\"font-weight: bold;\"\u003e THE BRIDGE\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\n*/\n```\n\n\n\n\n\n\n## clean codes formatter\n### `cleanCodes(string)`\nclean motd text color codes.\n```typescript\nimport motdParser from '@sfirew/minecraft-motd-parser' \nimport { cleanCodes } from '@sfirew/minecraft-motd-parser'\n\nconst motdText = \"§aHypixel Network §7§c1.8/1.9/1.10/1.11/1.12 §e§lNEW PTL GAME:§b§l THE BRIDGE\";\nconst result = cleanCodes(motdText);\nconsole.log(result);\n\n/* result, callback Text:\n * Hypixel Network 1.8/1.9/1.10/1.11/1.12 NEW PTL GAME: THE BRIDGE\n */\n```\n\n\n\n### `autoCleanToText(string | object)`\nauto check MOTD data type then return same cleaned text.\n```typescript\nimport motdParser from '@sfirew/minecraft-motd-parser' \nimport { autoCleanToText } from '@sfirew/minecraft-motd-parser'\n\nconst motdText = \"§aHypixel Network §7§c1.8/1.9/1.10/1.11/1.12 §e§lNEW PTL GAME:§b§l THE BRIDGE\";\nconst result = autoCleanToText(motdText);\nconsole.log(result);\n\n/* result, callback Text:\n * Hypixel Network 1.8/1.9/1.10/1.11/1.12 NEW PTL GAME: THE BRIDGE\n */\n```\n\n\n\n\n\n\n## origin formatter\n### `textToHTML(string)`\nconvert motd text to html.\n```typescript\nlet motdText = \"§aHypixel Network §7§c1.8/1.9/1.10/1.11/1.12 §e§lNEW PTL GAME:§b§l THE BRIDGE\";\nlet result = motdParser.textToHTML(motdText);\nconsole.log(result);\n\n/* result, callback HTML:\n * \u003cspan style=\"color: #55FF55;\"\u003eHypixel Network \u003cspan style=\"color: #AAAAAA;\"\u003e\u003cspan style=\"color: #FF5555;\"\u003e1.8/1.9/1.10/1.11/1.12 \u003cspan style=\"color: #FFFF55;\"\u003e\u003cspan style=\"font-weight: bold;\"\u003eNEW PTL GAME:\u003cspan style=\"color: acqua;\"\u003e\u003cspan style=\"font-weight: bold;\"\u003e THE BRIDGE\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\u003c/span\u003e\n */\n```\n\n![Image_2021_08_2021d-2021h_23___001](https://user-images.githubusercontent.com/14024836/129277576-e94914f3-35f7-45a6-8ba3-58163f71d5a1.png)\n\n\n\n\n### `textToJSON(string)`\nconvert motd json to html.\n```typescript\nlet motdText = \"§aHypixel Network §7§c1.8/1.9/1.10/1.11/1.12 §e§lNEW PTL GAME:§b§l THE BRIDGE\";\nlet result = motdParser.textToJSON(motdText);\nconsole.log(result);\n\n/* result, callback JSON:\n{\n  text: '',\n  extra: [\n    { text: '', extra: [] },\n    { text: 'Hypixel Network ', extra: [], color: '#55FF55' },\n    { text: '', extra: [], color: '#AAAAAA' },\n    { text: '1.8/1.9/1.10/1.11/1.12 ', extra: [], color: '#FF5555' },\n    { text: '', extra: [], color: '#FFFF55' },\n    { text: 'NEW PTL GAME:', extra: [], bold: true, color: '#FFFF55' },\n    { text: '', extra: [], bold: true, color: '#55FFFF' },\n    { text: ' THE BRIDGE', extra: [], bold: true, color: '#55FFFF' }\n  ]\n}\n */\n```\n\n\n### `JSONToHTML(object)`\nconvert text to motd json.\n```typescript\nlet mcfalloutJson = {\n  \"extra\": [\n    {\n      \"color\": \"gray\",\n      \"text\": \"  \"\n    },\n    {\n      \"color\": \"gold\",\n      \"text\": \"廢土伺服器  \"\n    },\n    {\n      \"color\": \"white\",\n      \"text\": \"mcFallout.net\"\n    },\n    {\n      \"color\": \"dark_gray\",\n      \"text\": \" - \"\n    },\n    {\n      \"color\": \"gray\",\n      \"text\": \"版本 1.17.1 \"\n    },\n    {\n      \"color\": \"gold\",\n      \"text\": \"洞穴\"\n    },\n    {\n      \"color\": \"light_purple\",\n      \"text\": \"與\"\n    },\n    {\n      \"color\": \"aqua\",\n      \"text\": \"山崖\\n\"\n    },\n    {\n      \"color\": \"gray\",\n      \"text\": \"  \"\n    },\n    {\n      \"color\": \"dark_gray\",\n      \"text\": \"享受工廠、農場、建築與紅石\"\n    }\n  ],\n  \"text\": \"\"\n}\nlet result = motdParser.JSONToHTML(mcfalloutJson);\nconsole.log(result)\n\n/* result, callback HTML:\n\u003cspan style=\"color: #AAAAAA;\"\u003e  \u003c/span\u003e\u003cspan style=\"color: #FFAA00;\"\u003e廢土伺服器  \u003c/span\u003e\u003cspan style=\"color: #FFFFFF;\"\u003emcFallout.net\u003c/span\u003e\u003cspan style=\"color: #555555;\"\u003e - \u003c/span\u003e\u003cspan style=\"color: #AAAAAA;\"\u003e版本 1.17.1 \u003c/span\u003e\u003cspan style=\"color: #FFAA00;\"\u003e洞穴\u003c/span\u003e\u003cspan style=\"color: #FF55FF;\"\u003e與\u003c/span\u003e\u003cspan style=\"color: #55FFFF;\"\u003e山崖\u003cbr/\u003e\u003c/span\u003e\u003cspan style=\"color: #AAAAAA;\"\u003e  \u003c/span\u003e\u003cspan style=\"color: #555555;\"\u003e享受工廠、農場、建築與紅石\u003c/span\u003e\n*/\n```\n\n![Image_2021_08_2021d-2021h_24___001](https://user-images.githubusercontent.com/14024836/129277638-fe8c5735-54fe-4ff1-afc5-4b5493706be9.png)\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowfirewolf%2Fminecraft-motd-parser","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnowfirewolf%2Fminecraft-motd-parser","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnowfirewolf%2Fminecraft-motd-parser/lists"}