Compare commits
No commits in common. "13077b1784cec99ef2742bf86bf30d4bc2d370f5" and "5382c2cb3d07cd899702196845f56a32cfa6cfb5" have entirely different histories.
13077b1784
...
5382c2cb3d
7 changed files with 9 additions and 24 deletions
|
@ -1,5 +1,3 @@
|
||||||
token=your.token
|
token=your.token
|
||||||
clientId=botClientId
|
clientId=botClientId
|
||||||
guildId=DevGuildId
|
guildId=DevGuildId
|
||||||
uptimeURL=uptimeKumaOrWhateverStatusThingYouUseOrJustLeaveEmpty
|
|
||||||
uptimeInterval=60
|
|
|
@ -85,7 +85,7 @@ async function download(url, interaction) {
|
||||||
const Embed = new MessageEmbed()
|
const Embed = new MessageEmbed()
|
||||||
.setColor(interaction.member ? interaction.member.displayHexColor : 'NAVY')
|
.setColor(interaction.member ? interaction.member.displayHexColor : 'NAVY')
|
||||||
.setAuthor(`Downloaded by ${interaction.member.displayName}`, interaction.member.displayAvatarURL(), url)
|
.setAuthor(`Downloaded by ${interaction.member.displayName}`, interaction.member.displayAvatarURL(), url)
|
||||||
.setFooter(`You can get the original video by clicking on the "Downloaded by ${interaction.member.displayName}" message!`);
|
.setDescription(url);
|
||||||
|
|
||||||
if (interaction.customId === 'downloadQuality') {
|
if (interaction.customId === 'downloadQuality') {
|
||||||
format = interaction.values[0];
|
format = interaction.values[0];
|
||||||
|
|
|
@ -6,8 +6,6 @@ module.exports = {
|
||||||
|
|
||||||
const command = client.commands.get(interaction.commandName);
|
const command = client.commands.get(interaction.commandName);
|
||||||
|
|
||||||
console.log(`\x1b[33m${interaction.user.tag}\x1b[0m launched command \x1b[33m${interaction.commandName}\x1b[0m`);
|
|
||||||
|
|
||||||
if (!command) return;
|
if (!command) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1,7 +1,4 @@
|
||||||
const { exec } = require('node:child_process');
|
const { exec } = require('node:child_process');
|
||||||
const https = require('node:https');
|
|
||||||
require('dotenv').config();
|
|
||||||
const { uptimeURL, uptimeInterval } = process.env;
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
name: 'ready',
|
name: 'ready',
|
||||||
|
@ -18,7 +15,6 @@ module.exports = {
|
||||||
resolve(stdout);
|
resolve(stdout);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
const commandSize = client.commands.size;
|
const commandSize = client.commands.size;
|
||||||
const clientTag = client.user.tag;
|
const clientTag = client.user.tag;
|
||||||
const guildSize = client.guilds.cache.size;
|
const guildSize = client.guilds.cache.size;
|
||||||
|
@ -30,19 +26,7 @@ module.exports = {
|
||||||
console.log(`Ready to serve in \x1b[33m${channelSize}\x1b[0m channels on \x1b[33m${guildSize}\x1b[0m servers.`);
|
console.log(`Ready to serve in \x1b[33m${channelSize}\x1b[0m channels on \x1b[33m${guildSize}\x1b[0m servers.`);
|
||||||
console.log(`${client.readyAt}`);
|
console.log(`${client.readyAt}`);
|
||||||
console.log(`There is \x1b[33m${commandSize}\x1b[0m command loaded.`);
|
console.log(`There is \x1b[33m${commandSize}\x1b[0m command loaded.`);
|
||||||
console.log(`Running yt-dlp \x1b[33m${ytdlpVersion.replace('\n', '')}\x1b[0m`);
|
console.log(`Running yt-dlp \x1b[33m${ytdlpVersion}\x1b[0m`);
|
||||||
console.log('===========[ READY ]===========');
|
console.log('===========[ READY ]===========');
|
||||||
|
|
||||||
if (uptimeURL != '') {
|
|
||||||
pingStatus(client, 'Starting up');
|
|
||||||
|
|
||||||
setInterval(() => {
|
|
||||||
pingStatus(client, 'OK');
|
|
||||||
}, uptimeInterval * 1000);
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
async function pingStatus(client, msg) {
|
|
||||||
https.get(`${uptimeURL}msg=${msg}&ping=${Math.round(client.ws.ping)}`);
|
|
||||||
}
|
|
5
index.js
5
index.js
|
@ -1,9 +1,11 @@
|
||||||
|
// Require the necessary discord.js classes
|
||||||
const fs = require('node:fs');
|
const fs = require('node:fs');
|
||||||
const path = require('node:path');
|
const path = require('node:path');
|
||||||
const { Client, Collection, Intents } = require('discord.js');
|
const { Client, Collection, Intents } = require('discord.js');
|
||||||
require('dotenv').config();
|
require('dotenv').config();
|
||||||
const { token } = process.env;
|
const { token } = process.env;
|
||||||
|
|
||||||
|
// Create a new client instance
|
||||||
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
|
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
|
||||||
|
|
||||||
// Load commands from the commands folder
|
// Load commands from the commands folder
|
||||||
|
@ -14,6 +16,8 @@ const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('
|
||||||
for (const file of commandFiles) {
|
for (const file of commandFiles) {
|
||||||
const filePath = path.join(commandsPath, file);
|
const filePath = path.join(commandsPath, file);
|
||||||
const command = require(filePath);
|
const command = require(filePath);
|
||||||
|
// Set a new item in the Collection
|
||||||
|
// With the key as the command name and the value as the exported module
|
||||||
|
|
||||||
client.commands.set(command.data.name, command);
|
client.commands.set(command.data.name, command);
|
||||||
}
|
}
|
||||||
|
@ -33,4 +37,5 @@ for (const file of eventFiles) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Login to Discord with your client's token
|
||||||
client.login(token);
|
client.login(token);
|
||||||
|
|
|
@ -23,7 +23,7 @@ git checkout slash
|
||||||
npm install
|
npm install
|
||||||
```
|
```
|
||||||
|
|
||||||
To run the bot for the first time you need to execute [deploy-guild-commands.js](deploy-guild-commands.js) so the commands can be registered, don't forget to set your .env accordingly.
|
To run the bot for the first time you need to execute [deploy-commands.js](deploy-commands.js) so the commands can be registered, don't forget to set your .env accordingly.
|
||||||
``node deploy-commands.js``
|
``node deploy-commands.js``
|
||||||
|
|
||||||
then you can just run it normally.
|
then you can just run it normally.
|
||||||
|
|
Loading…
Reference in a new issue