Skip to content

Commit

Permalink
refactor: added types
Browse files Browse the repository at this point in the history
  • Loading branch information
kk committed Nov 8, 2023
1 parent bcffa3b commit 74c240f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions src/commands/skyblock/SkyblockNetworthCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class SkyblockNetworthCommand extends CommandBase {
super({ name: "nw", description: "Gets a player's networth (if enabled)", minecraftBot });
}

public execute = async ({ player, params }: CommandExecute) => {
public execute = async ({ player, params }: CommandExecute) =>
useHypixelApi(this.getBotInstance(), async (hypixelClient) => {
const cleanPlayerName = sanatiseMessage(player).trim();
let playerUuid;
Expand All @@ -30,16 +30,15 @@ class SkyblockNetworthCommand extends CommandBase {
const bankBalance = profileData?.banking?.balance ?? 0;
const { getNetworth } = require("skyhelper-networth");
const playerNetworth = await getNetworth(profileData.members[playerUuid], bankBalance);
const formattedString = `$${playerNetworth}`;
const formattedString = `$${ playerNetworth }`;

this.getBotInstance().getMineflayerInstance().chat(formattedString);
const embed = new EmbedBuilder().setTitle(`The networth of ${selectedPlayerName}`).setDescription(`${selectedPlayerName}'s networth: ${formattedString}`).setColor("DarkGold").setThumbnail(`https://crafthead.net/avatar/${playerUuid}`);
const embed = new EmbedBuilder().setTitle(`The networth of ${ selectedPlayerName }`).setDescription(`${ selectedPlayerName }'s networth: ${ formattedString }`).setColor("DarkGold").setThumbnail(`https://crafthead.net/avatar/${ playerUuid }`);
this.getBotInstance().sendToDiscord(embed);
} else {
this.getBotInstance().getMineflayerInstance().chat(`Couldn't find an active profile by this name.`);
}
});
};
}

export default SkyblockNetworthCommand;
2 changes: 1 addition & 1 deletion src/util/CommandHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export type CommandExecute = {
export abstract class CommandBase {
private readonly name;
private readonly description;
private readonly minecraftInstance;
private readonly minecraftInstance: MinecraftBot;

protected constructor({ name, description, minecraftBot }: CommandRegister) {
this.name = name;
Expand Down

0 comments on commit 74c240f

Please sign in to comment.