Add configuration for uptime-kuma monitoring
This commit is contained in:
parent
325bd25f07
commit
e70cdd972c
|
@ -25,5 +25,11 @@
|
||||||
"enabled": false,
|
"enabled": false,
|
||||||
"username": "YOUR_USERNAME",
|
"username": "YOUR_USERNAME",
|
||||||
"password": "YOUR_PASSWORD"
|
"password": "YOUR_PASSWORD"
|
||||||
|
},
|
||||||
|
,
|
||||||
|
"uptime-kuma": {
|
||||||
|
"enabled": false,
|
||||||
|
"url": "",
|
||||||
|
"interval": 60
|
||||||
}
|
}
|
||||||
}
|
}
|
22
index.js
22
index.js
|
@ -432,6 +432,14 @@ xmpp.on("stanza", (stanza) => {
|
||||||
|
|
||||||
|
|
||||||
xmpp.on("online", async (address) => {
|
xmpp.on("online", async (address) => {
|
||||||
|
if (config["uptime-kuma"].enabled) {
|
||||||
|
setInterval(() => {
|
||||||
|
// Send POST request to config["uptime-kuma"].url
|
||||||
|
fetch(config["uptime-kuma"].url, {
|
||||||
|
method: 'POST'
|
||||||
|
})
|
||||||
|
}, config["uptime-kuma"].interval * 1000) // Every X seconds
|
||||||
|
}
|
||||||
|
|
||||||
errCount = 0;
|
errCount = 0;
|
||||||
// Start listening on all channels, (dont ban me funny man)
|
// Start listening on all channels, (dont ban me funny man)
|
||||||
|
@ -959,11 +967,11 @@ discord.on("interactionCreate", async (interaction) => {
|
||||||
if (!channel) return interaction.reply({ content: "You need to be in a voice channel", ephemeral: true });
|
if (!channel) return interaction.reply({ content: "You need to be in a voice channel", ephemeral: true });
|
||||||
// Join the channel and play the stream
|
// Join the channel and play the stream
|
||||||
res = JoinChannel(channel, url, .1, interaction)
|
res = JoinChannel(channel, url, .1, interaction)
|
||||||
if (res) {
|
if (res) {
|
||||||
interaction.reply({ content: "Playing Stream", ephemeral: true });
|
interaction.reply({ content: "Playing Stream", ephemeral: true });
|
||||||
} else {
|
} else {
|
||||||
interaction.reply({ content: `Failed to play stream`, ephemeral: true });
|
interaction.reply({ content: `Failed to play stream`, ephemeral: true });
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "play": // Play generic stream
|
case "play": // Play generic stream
|
||||||
|
@ -1008,13 +1016,13 @@ discord.on("interactionCreate", async (interaction) => {
|
||||||
case "volume": // Set volume
|
case "volume": // Set volume
|
||||||
channel = interaction.member.voice.channel;
|
channel = interaction.member.voice.channel;
|
||||||
if (!channel) return interaction.reply({ content: "You need to be in a voice channel", ephemeral: true });
|
if (!channel) return interaction.reply({ content: "You need to be in a voice channel", ephemeral: true });
|
||||||
volume = interaction.options.getInteger("volume")/100;
|
volume = interaction.options.getInteger("volume") / 100;
|
||||||
// Make sure volume isnt negative
|
// Make sure volume isnt negative
|
||||||
if (volume < 0) volume = 0;
|
if (volume < 0) volume = 0;
|
||||||
if (volume > 1) volume = 1;
|
if (volume > 1) volume = 1;
|
||||||
res = setVolume(channel, volume)
|
res = setVolume(channel, volume)
|
||||||
if (res) {
|
if (res) {
|
||||||
interaction.reply({ content: `Set volume to ${volume*100}%` });
|
interaction.reply({ content: `Set volume to ${volume * 100}%` });
|
||||||
} else {
|
} else {
|
||||||
interaction.reply({ content: "Failed to set volume", ephemeral: true });
|
interaction.reply({ content: "Failed to set volume", ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue