-
-
Notifications
You must be signed in to change notification settings - Fork 130
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9690cd1
commit 0635bf4
Showing
8 changed files
with
253 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
const { MessageEmbed } = require("discord.js"); | ||
|
||
module.exports = { | ||
name: "base64", | ||
category: "Utility", | ||
description: "🗃️ Encode or decode text to Base64 format", | ||
usage: "/base64 <encode/decode> <text>", | ||
container: true, | ||
options: [ | ||
{ | ||
name: "encode", | ||
description: "🗃️ Encode text to Base64 format", | ||
type: 1, | ||
usage: `/base64 encode <text>`, | ||
category: "Utility", | ||
orgin: "base64", | ||
options: [ | ||
{ | ||
name: "text", | ||
description: "The text to encode", | ||
required: true, | ||
type: 3, | ||
} | ||
] | ||
}, | ||
{ | ||
name: "decode", | ||
description: "🗃️ Decode Base64 text", | ||
type: 1, | ||
usage: `/base64 decode <text>`, | ||
category: "Utility", | ||
orgin: "base64", | ||
options: [ | ||
{ | ||
name: "text", | ||
description: "The text to decode", | ||
required: true, | ||
type: 3, | ||
} | ||
] | ||
|
||
} | ||
], | ||
run: async (client, interaction, args) => { | ||
try { | ||
if(args[0] === "encode") { | ||
require("./modules/base64/encode")(client, interaction, args); | ||
} else if(args[0] === "decode") { | ||
require("./modules/base64/decode")(client, interaction, args); | ||
} | ||
} catch (err) { | ||
console.log(err); | ||
return client.createSlashCommandError(interaction, err); | ||
} | ||
}, | ||
}; |
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,50 @@ | ||
const { Color, isColor } = require("coloras"); | ||
const { MessageEmbed } = require("discord.js"); | ||
|
||
module.exports = { | ||
name: "color", | ||
description: "🎨 Shows color info", | ||
category: "Utility", | ||
usage: "/color [color]", | ||
options: [ | ||
{ | ||
name: "color", | ||
description: "The color to show info about", | ||
required: false, | ||
type: 3, | ||
} | ||
], | ||
run: async (client, interaction, args) => { | ||
try { | ||
!args[0] ? random = true : random = false; | ||
if (!random && !isColor(args[0]).color) { | ||
return client.createSlashError(interaction, `${client.bot_emojis.error} | Please provide a valid color`); | ||
} | ||
console.log(random) | ||
const value = random ? null : args[0]; | ||
console.log(value) | ||
const color = new Color(value); | ||
const embed = new MessageEmbed() // Prettier | ||
.setTitle(random ? `${client.bot_emojis.color} Random Color` : `${client.bot_emojis.color} Color: ${color.toHex()}`) | ||
.addField("HEX", `> \`${color.toHex()}\``, true) | ||
.addField("RGB",`> \`${color.toRgb()}\``, true) | ||
.addField("HSL", `> \`${color.toHsl()}\``, true) | ||
.addField("HSV", `> \`${color.toHsv()}\``, true) | ||
.addField("CMYK", `> \`${color.toCmyk()}\``, true) | ||
.setImage(color.imageUrl) | ||
.setColor(color.toHex()) | ||
.setFooter({ | ||
text: `Requested by ${interaction.user.username}`, | ||
iconURL: interaction.user.displayAvatarURL({ | ||
dynamic: true, | ||
format: "png", | ||
size: 2048, | ||
}), | ||
}); | ||
interaction.followUp({ embeds: [embed] }); | ||
} catch (err) { | ||
console.log(err); | ||
return client.createSlashCommandError(interaction, err); | ||
} | ||
}, | ||
}; |
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,89 @@ | ||
const { MessageEmbed } = require("discord.js"); | ||
const fetch = require("node-fetch"); | ||
|
||
module.exports = { | ||
name: "minecraft", | ||
description: "🌳 Display minecraft server info", | ||
category: "Utility", | ||
usage: "/minecraft <server ip> [bedrock]", | ||
container: true, | ||
options: [ | ||
{ | ||
name: "server_ip", | ||
description: "The IP of the server to get info about", | ||
required: true, | ||
type: 3, | ||
}, | ||
{ | ||
name: "bedrock", | ||
description: "Display bedrock info", | ||
required: false, | ||
type: 5 | ||
} | ||
], | ||
run: async (client, interaction, args) => { | ||
try { | ||
if (!args[0]) { | ||
return client.createSlashError(interaction, `${client.bot_emojis.error} | Please enter a minecraft server IP!`); | ||
} | ||
if (!/^([a-z0-9]+(-[a-z0-9]+)*\.)+[a-z]{2,}(:?[0-9]*)$/gim.test(args[0])) { | ||
return client.createSlashError(interaction, `${client.bot_emojis.error} | Please enter a vaild minecraft server IP!`); | ||
} | ||
if (args[1]) { | ||
fetch(`https://api.mcsrvstat.us/bedrock/2/${args[0]}`) | ||
.then((res) => res.json()) | ||
.then((body) => { | ||
if (body.ip == "127.0.0.1" || !body.ip) { | ||
return client.createSlashError(interaction, `${client.bot_emojis.error} | Minecraft bedrock server not found!`); | ||
} | ||
const embed = new MessageEmbed() // Prettier | ||
.setAuthor({ name: `${args[0]} (Bedrock)`, iconURL: `https://api.mcsrvstat.us/icon/${args[0]}` }) | ||
.setThumbnail(`https://api.mcsrvstat.us/icon/${args[0]}`) | ||
.setFooter({ | ||
text: `Requested by ${interaction.user.username}`, | ||
iconURL: interaction.user.displayAvatarURL({ | ||
dynamic: true, | ||
format: "png", | ||
size: 2048, | ||
}), | ||
}) | ||
.setColor("#5865F2"); | ||
if (body.online.toString().length > 1) embed.addField(`${body.online ? client.bot_emojis.status_online : client.bot_emojis.status_dnd} ${body.online ? "Online" : "Offline"}`, `> \`${body.online ? "Online" : "Offline"}\``, true); | ||
if (body.motd && body.motd.raw[0]) embed.setDescription(">>> " + body.motd.raw[0].replace(/§[0-9A-FK-OR]/gi, "").replaceAll("`", "")); | ||
if (body.players && body.players.max && body.players.online) embed.addField(`${client.bot_emojis.member} Players`, `> \`${body.players.online}/${body.players.max}\``, true); | ||
if (body.version) embed.addField(`${client.bot_emojis.stage_channel} Version(s)`, `> \`${body.version}\``, true); | ||
interaction.followUp({ embeds: [embed] }); | ||
}); | ||
} else { | ||
fetch(`https://api.minetools.eu/ping/${args[0].replace(":", "/")}`) | ||
.then((res) => res.json()) | ||
.then((body) => { | ||
if (body.error) { | ||
return client.createSlashError(interaction, `${client.bot_emojis.error} | Minecraft server not found!\n\n**Tip:** If you want to check Bedrock server please use \`/minecraft <server ip> [bedrock=true]\``); | ||
} | ||
const embed = new MessageEmbed() // Prettier | ||
.setAuthor({ name: args[0], iconURL: `https://api.mcsrvstat.us/icon/${args[0].replace(":", "/")}` }) | ||
.setThumbnail(`https://api.mcsrvstat.us/icon/${args[0].replace(":", "/")}`) | ||
.setColor("#5865F2") | ||
.setFooter({ | ||
text: `Requested by ${interaction.user.username}`, | ||
iconURL: interaction.user.displayAvatarURL({ | ||
dynamic: true, | ||
format: "png", | ||
size: 2048, | ||
}), | ||
}); | ||
if (body.description) embed.setDescription(`>>> ${body.description && body.description.length > 1 ? body.description.replace(/§[0-9A-FK-OR]/gi, "").replaceAll("\`", "") : "No description"}`); | ||
if (body.players && body.players.max && body.players.online) embed.addField(`${client.bot_emojis.member} Players`, `> \`${body.players.online}/${body.players.max}\``, true); | ||
if (body.latency) embed.addField(`${client.bot_emojis.status_online} Latency`, `> \`${body.latency}\``, true); | ||
if (body.version && body.version.name) embed.addField(`${client.bot_emojis.stage_channel} Version(s)`, `> \`${body.version.name}\``, true); | ||
embed.setTimestamp(); | ||
interaction.followUp({ embeds: [embed] }); | ||
}); | ||
} | ||
} catch (err) { | ||
console.log(err); | ||
return client.createSlashCommandError(interaction, err); | ||
} | ||
}, | ||
}; |
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,28 @@ | ||
const { MessageEmbed } = require("discord.js") | ||
|
||
module.exports = async(client, interaction, args) => { | ||
try { | ||
if (args[1].toString().length > client.max_input) { | ||
return client.createSlashError(interaction, `${client.bot_emojis.error} | You must enter a text shorter than \`${client.max_input}\` characters!`); | ||
} | ||
const buffer = new Buffer.from(args[1], "base64"); | ||
const base64 = buffer.toString("utf-8"); | ||
const embed = new MessageEmbed() | ||
.setColor("#5865F2") | ||
.setFooter({ | ||
text: `Requested by ${interaction.user.username}`, | ||
iconURL: interaction.user.displayAvatarURL({ | ||
dynamic: true, | ||
format: "png", | ||
size: 2048, | ||
}), | ||
}) | ||
.setTitle(`${client.bot_emojis.sparkles} Base64 Encode`) | ||
.addField(`${client.bot_emojis.input} Text to encode`, `\`\`\`${args[1]}\`\`\``) | ||
.addField(`${client.bot_emojis.output} Encoded text`, `\`\`\`${base64 || "An unknown error ocurred while encoding!"}\`\`\``); | ||
interaction.followUp({ embeds: [embed] }); | ||
} catch (err) { | ||
console.log(err); | ||
return client.createSlashCommandError(interaction, err); | ||
} | ||
} |
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,28 @@ | ||
const { MessageEmbed } = require("discord.js") | ||
|
||
module.exports = async(client, interaction, args) => { | ||
try { | ||
if (args[1].toString().length > client.max_input) { | ||
return client.createSlashError(interaction, `${client.bot_emojis.error} | You must enter a text shorter than \`${client.max_input}\` characters!`); | ||
} | ||
const buffer = new Buffer.from(args[1], "utf-8"); | ||
const base64 = buffer.toString("base64"); | ||
const embed = new MessageEmbed() | ||
.setColor("#5865F2") | ||
.setFooter({ | ||
text: `Requested by ${interaction.user.username}`, | ||
iconURL: interaction.user.displayAvatarURL({ | ||
dynamic: true, | ||
format: "png", | ||
size: 2048, | ||
}), | ||
}) | ||
.setTitle(`${client.bot_emojis.sparkles} Base64 Encode`) | ||
.addField(`${client.bot_emojis.input} Text to encode`, `\`\`\`${args[1]}\`\`\``) | ||
.addField(`${client.bot_emojis.output} Encoded text`, `\`\`\`${base64 || "An unknown error ocurred while encoding!"}\`\`\``); | ||
interaction.followUp({ embeds: [embed] }); | ||
} catch (err) { | ||
console.log(err); | ||
return client.createSlashCommandError(interaction, err); | ||
} | ||
} |
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 |
---|---|---|
|
@@ -139,4 +139,5 @@ module.exports = { | |
arrows_clockwise: "🔃", | ||
jigsaw: "🧩", | ||
wave: "👋", | ||
color: "🎨", | ||
}; |
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