-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mc user cmd, try to get user skin type automatically
- Loading branch information
1 parent
91f68e2
commit 9247258
Showing
4 changed files
with
109 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { type ChatInputCommandInteraction, EmbedBuilder } from "discord.js"; | ||
import type { Client } from "../../../structures/DiscordClient"; | ||
import type { Player } from "../../../types/minecraftPlayer"; | ||
import axios from "axios"; | ||
|
||
export default async function ( | ||
client: Client, | ||
int: ChatInputCommandInteraction, | ||
) { | ||
const player = int.options.getString("player", true); | ||
|
||
await int.deferReply(); | ||
|
||
try { | ||
const playerInfo = await axios.get(`https://starlightskins.lunareclipse.studio/info/user/${player}`); | ||
|
||
const playerData = playerInfo.data as Player; | ||
|
||
const embedFields = [ | ||
{ | ||
name: "Skin", | ||
value: `[View Skin](${playerData.skinUrl})`, | ||
inline: true | ||
}, | ||
] | ||
|
||
if (playerData.processedSkinUrl) embedFields.push({ | ||
name: "Processed Skin (32px -> 64px)", | ||
value: `[View Processed Skin](${playerData.processedSkinUrl})`, | ||
inline: true | ||
}) | ||
|
||
embedFields.push( | ||
{ | ||
name: "Skin Type", | ||
value: playerData.skinType, | ||
inline: true | ||
}, | ||
{ | ||
name: "Skin Texture Width", | ||
value: `${playerData.skinTextureWidth}`, | ||
inline: true | ||
}, | ||
{ | ||
name: "Skin Texture Height", | ||
value: `${playerData.skinTextureHeight}`, | ||
inline: true | ||
} | ||
) | ||
|
||
const embed = new EmbedBuilder() | ||
.setTitle(player) | ||
.addFields(embedFields) | ||
.setFooter({ | ||
text: playerData.playerUUID | ||
}) | ||
|
||
await int.editReply({ | ||
embeds: [embed] | ||
}) | ||
} catch(e) { | ||
await int.editReply({ | ||
content: "The user was not found" | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { SkinType } from "./minecraftSkin"; | ||
|
||
export interface Player { | ||
processedSkinUrl?: string; | ||
skinTextureHeight: number; | ||
skinTextureWidth: number; | ||
playerUUID: string; | ||
skinType: SkinType; | ||
userCape?: string; | ||
skinUrl: string; | ||
} |