Initial commit
This commit is contained in:
63
commands/check.js
Normal file
63
commands/check.js
Normal file
@@ -0,0 +1,63 @@
|
||||
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
const { hypixelApiKey, dev } = require('../config.json');
|
||||
|
||||
module.exports = {
|
||||
name: 'check',
|
||||
description: 'Check a player\'s stats.',
|
||||
type: 'slash',
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('check')
|
||||
.setDescription('Check a player\'s stats.')
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName('ign')
|
||||
.setDescription('The player\'s IGN.')
|
||||
.setRequired(true))
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
const ign = interaction.options.getString('ign');
|
||||
const mojang = "https://api.mojang.com/users/profiles/minecraft/"
|
||||
const slothPixel = "https://api.slothpixel.me/api/players/";
|
||||
const minotar = "https://minotar.net/helm/";
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
const userCheck = await fetch(mojang + ign);
|
||||
const stats = await fetch(slothPixel + ign);
|
||||
const head = await fetch(minotar + ign + "/100.png");
|
||||
|
||||
if (interaction.user.id !== dev) {
|
||||
interaction.reply('This command is currently under development.')
|
||||
return
|
||||
}
|
||||
|
||||
if (!ign) {
|
||||
interaction.reply('Please provide a player\'s IGN.')
|
||||
return
|
||||
}
|
||||
|
||||
if (!userCheck.status === 200) {
|
||||
interaction.reply('That player doesn\'t exist. [Mojang]')
|
||||
return
|
||||
}
|
||||
|
||||
if (!stats.status === 200) {
|
||||
interaction.reply('That player doesn\'t exist. [Hypixel]')
|
||||
return
|
||||
}
|
||||
|
||||
await interaction.reply({
|
||||
embeds: [{
|
||||
title: ign,
|
||||
description: stats.stats.Bedwars.level,
|
||||
color: 0x00ff00,
|
||||
thumbnail: {
|
||||
url: head
|
||||
},
|
||||
}]
|
||||
});
|
||||
|
||||
}
|
||||
};
|
||||
52
commands/send.js
Normal file
52
commands/send.js
Normal file
@@ -0,0 +1,52 @@
|
||||
const { SlashCommandBuilder, PermissionFlagsBits } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
name: 'send',
|
||||
description: 'Send a message to a channel.',
|
||||
type: 'slash',
|
||||
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('send')
|
||||
.setDescription('Send a message to a channel.')
|
||||
.addStringOption(option =>
|
||||
option
|
||||
.setName('message')
|
||||
.setDescription('The message to send.'))
|
||||
.addChannelOption(option =>
|
||||
option
|
||||
.setName('channel')
|
||||
.setDescription('The channel to send the message to.'))
|
||||
.setDMPermission(false),
|
||||
|
||||
async execute(interaction) {
|
||||
|
||||
const message = interaction.options.getString('message');
|
||||
const channel = interaction.options.getChannel('channel');
|
||||
|
||||
if (!message) {
|
||||
interaction.reply({ content: 'Please provide a message to send.', ephemeral: true })
|
||||
return
|
||||
}
|
||||
|
||||
if (!channel) {
|
||||
interaction.reply({ content: 'Please provide a channel to send the message to.', ephemeral: true })
|
||||
return
|
||||
}
|
||||
|
||||
channel.send({
|
||||
embeds: [
|
||||
{
|
||||
title: interaction.guild.name,
|
||||
description: message,
|
||||
color: 0x00ff00,
|
||||
thumbnail: {
|
||||
url: interaction.guild.iconURL({ dynamic: true })
|
||||
},
|
||||
footer: {
|
||||
text: "Developed by @Taken#0002"
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user