This commit is contained in:
DeSqBlocki
2025-02-04 21:43:22 +01:00
parent 7ed2031cde
commit 473a715450
9 changed files with 1358 additions and 0 deletions
+65
View File
@@ -0,0 +1,65 @@
const { MessageEmbed } = require("discord.js")
const TwitchApi = require("node-twitch").default
const twitch = new TwitchApi({
client_id: process.env.TTV_ID,
client_secret: process.env.TTV_SECRET
});
module.exports = {
category: 'Twitch',
description: 'Shows You If A Stream Is Online',
testOnly: true,
expectedArgs: '<channel>',
callback: async ({ client, args, interaction, message }) => {
var channel = args[0]
if (!args.length) {
channel = 'x__hel__x' //default
}
async function Twitch(stream) {
var streamData = undefined
await twitch.getStreams({ channel: stream }).then(async data => {
const r = data.data[0]
if (r) {
streamData = {
"game": r.game_name,
"title": r.title,
}
} else {
}
})
return streamData
}
const streamdata = await Twitch(channel)
var reply
var embed
if (!streamdata || streamdata === undefined) {
reply = `<https://twitch.tv/${channel}> is currently offline!`
} else {
const imageUrl = `https://static-cdn.jtvnw.net/previews-ttv/live_user_${channel.toLowerCase()}.jpg`
embed = new MessageEmbed()
.setTitle(`twitch.tv/${channel}`)
.setURL(`https://twitch.tv/${channel}`)
.setDescription(`${channel} is **live**!\n\nThey're playing **${streamdata.game}**\n [${streamdata.title}]`)
.setTimestamp()
.setFooter('HelBot by DeSqBlocki', 'https://cdn.discordapp.com/attachments/345238918582763520/901262809466282034/HelBotIcon.png')
.setImage(imageUrl)
}
if (interaction){
if(!streamdata || streamdata === undefined){
return reply
} else {
return embed
}
}
if (message){
if(!streamdata || streamdata === undefined){
return reply
} else {
return embed
}
}
}
}
+66
View File
@@ -0,0 +1,66 @@
const { MessageEmbed } = require('discord.js')
const mcsrv = require('mcsrvstat-api')
module.exports = {
category: 'Minecraft',
description: 'Minecraft Server Information',
slash: 'both',
testOnly: true,
callback: ({ client, message, interaction }) => {
mcsrv.fetchData("bettermc.desq-gaming.de")
.then((data) => {
if (data.online === false) {
if (message) {
message.reply({ content: 'Could Not Fetch Server Info. Is It Offline?' })
.then(msg => {
setTimeout(() => {
message.delete()
return msg.delete()
}, 15000)
})
}
if (interaction) {
interaction.reply({ content: 'Could Not Get All Infos. Is It Offline?' })
.then(() => {
setTimeout(() => {
return client.api.webhooks(client.user.id, interaction.token).messages("@original").delete();
}, 15000)
})
}
} else {
const embed = new MessageEmbed()
.setTitle(data.hostname)
.setURL(`https://mcsrvstat.us/server/bettermc.desq-gaming.de`)
.setThumbnail('https://cdn.discordapp.com/attachments/345238918582763520/885475680014458900/PixelHel.png')
.setAuthor(`${data.motd.clean}`)
.addFields(
{ name: "IP:", value: `${data.ip}:${data.port}` },
{ name: "Game Version:", value: `${data.version}`, inline: true },
{ name: "Currently Online:", value: `${data.players.online}`, inline: true }
)
.setTimestamp()
.setFooter('HelBot by DeSqBlocki', 'https://cdn.discordapp.com/attachments/345238918582763520/901262809466282034/HelBotIcon.png')
if(data.mods){
embed.addFields({ name: "Mods Installed:", value: `${data.mods.names.length}`, inline: true })
}
if (message) {
message.reply({ embeds: [embed] })
.then(msg => {
setTimeout(() => {
message.delete()
return msg.delete()
}, 15000)
})
}
if (interaction) {
interaction.reply({ embeds: [embed] })
.then(msg => {
setTimeout(() => {
return client.api.webhooks(client.user.id, interaction.token).messages("@original").delete();
}, 15000)
})
}
}
})
}
}
+10
View File
@@ -0,0 +1,10 @@
module.exports = {
category: 'Admin',
description: 'Replies with pong',
slash: 'both',
testOnly: true,
callback: ({ }) => {
return "Pong!"
}
}
+40
View File
@@ -0,0 +1,40 @@
const { MessageEmbed } = require('discord.js')
const mcsrv = require('mcsrvstat-api')
module.exports = {
category: 'Minecraft',
description: 'Minecraft Server Availabilty',
slash: 'both',
testOnly: true,
callback: ({client, message, interaction}) => {
const server = "bettermc.desq-gaming.de"
mcsrv.isOnline(server)
.then((bool) =>{
const embed = new MessageEmbed()
.setTitle(server)
.setURL(`https://mcsrvstat.us/server/bettermc.desq-gaming.de`)
.setThumbnail('https://cdn.discordapp.com/attachments/345238918582763520/885475680014458900/PixelHel.png')
.setDescription(
`The Server Is **${bool?"":"Not "}Online!**`
)
.setTimestamp()
.setFooter('HelBot by DeSqBlocki', 'https://cdn.discordapp.com/attachments/345238918582763520/901262809466282034/HelBotIcon.png')
if (message) {
message.reply({ embeds: [embed] })
.then(msg => {
setTimeout(() => {
message.delete()
return msg.delete()
}, 15000)
})
}
if (interaction) {
interaction.reply({ embeds: [embed] })
.then(msg => {
setTimeout(() => {
return client.api.webhooks(client.user.id, interaction.token).messages("@original").delete();
}, 15000)
})
}
})
}
}