updated mcs generated image footer
This commit is contained in:
parent
51f2a5cb27
commit
b8e11d5c5c
@ -8,7 +8,7 @@
|
|||||||
"prisma": "^6.6.0"
|
"prisma": "^6.6.0"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "bun --env-file=.env --watch src/index.ts"
|
"dev": "bun --env-file=.env --hot src/index.ts"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
"typescript": "^5"
|
"typescript": "^5"
|
||||||
|
@ -70,13 +70,15 @@ export default class McsCommand extends Command {
|
|||||||
|
|
||||||
const page = await browser.newPage();
|
const page = await browser.newPage();
|
||||||
const status: Status = data.status as any
|
const status: Status = data.status as any
|
||||||
let result = `<p>${ip} - Latency ${data.latency}</p>`
|
let result = `<p>${ip} - Latency ${data.latency} ms</p>`
|
||||||
result += `<p>Version: ${status.version.name} - ${status.version.protocol}</p>`
|
result += `<p>Version: ${status.version.name} - ${status.version.protocol}</p>`
|
||||||
result += `<p>${motdParser(status.description)}</p>`
|
result += `<p>${motdParser(status.description)}</p>`
|
||||||
result += `<p>Online - ${status.players.online}/${status.players.max}</p>`
|
result += `<p>Online - ${status.players.online}/${status.players.max}</p>`
|
||||||
const html = generateHtml(result, status.favicon)
|
const html = generateHtml(result, status.favicon)
|
||||||
|
|
||||||
await page.setViewport({ width: 650, height: 340})
|
let hight = 340
|
||||||
|
if (!status.favicon) hight = 300
|
||||||
|
await page.setViewport({ width: 650, height: hight })
|
||||||
await page.setContent(html)
|
await page.setContent(html)
|
||||||
await page.waitForSelector('body')
|
await page.waitForSelector('body')
|
||||||
const screenshot = await page.screenshot({
|
const screenshot = await page.screenshot({
|
||||||
@ -133,14 +135,14 @@ function generateHtml(result: string, icon64: string): string {
|
|||||||
</head>
|
</head>
|
||||||
<body style="width: 650px">
|
<body style="width: 650px">
|
||||||
<div class="container mx-auto py-8">
|
<div class="container mx-auto py-8">
|
||||||
<div class="text-center"><img src=${icon64} alt="icon" class="w-80px h-80px mx-auto" /></div>
|
${icon64 ? `<div class="text-center"><img src=${icon64} alt="icon" class="w-80px h-80px mx-auto" /></div>` : ''}
|
||||||
<div class="text-center mt-4">
|
<div class="text-center mt-4">
|
||||||
<div class="text-lg font-bold text-[#cdd6f4]">${result}</div>
|
<div class="text-lg font-bold text-[#cdd6f4]">${result}</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<footer class="bg-[#313244] text-center py-2">
|
<footer class="bg-[#313244] text-center py-2">
|
||||||
<p class="text-sm text-[#cdd6f4]">Generated by Fantastic Spoon - Discord</p>
|
<p class="text-sm text-[#cdd6f4]">Generated by Fantastic Spoon - Discord</p>
|
||||||
<p class="text-sm text-[#cdd6f4]">https://git.itzdrli.cc/itzdrli/fantastic_spoon_dc</p>
|
<p class="text-sm text-[#cdd6f4]">Open Sourced on git.itzdrli.cc © 2025 itzdrli - All Rights Reserved. </p>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>`;
|
</html>`;
|
||||||
|
Loading…
Reference in New Issue
Block a user