Compare commits
5 commits
5382c2cb3d
...
13077b1784
Author | SHA1 | Date | |
---|---|---|---|
13077b1784 | |||
c7922c31b0 | |||
41ee5a74a6 | |||
49b7b73938 | |||
9762f21a13 |
7 changed files with 24 additions and 9 deletions
|
@ -1,3 +1,5 @@
|
|||
token=your.token
|
||||
clientId=botClientId
|
||||
guildId=DevGuildId
|
||||
uptimeURL=uptimeKumaOrWhateverStatusThingYouUseOrJustLeaveEmpty
|
||||
uptimeInterval=60
|
|
@ -85,7 +85,7 @@ async function download(url, interaction) {
|
|||
const Embed = new MessageEmbed()
|
||||
.setColor(interaction.member ? interaction.member.displayHexColor : 'NAVY')
|
||||
.setAuthor(`Downloaded by ${interaction.member.displayName}`, interaction.member.displayAvatarURL(), url)
|
||||
.setDescription(url);
|
||||
.setFooter(`You can get the original video by clicking on the "Downloaded by ${interaction.member.displayName}" message!`);
|
||||
|
||||
if (interaction.customId === 'downloadQuality') {
|
||||
format = interaction.values[0];
|
||||
|
|
|
@ -6,6 +6,8 @@ module.exports = {
|
|||
|
||||
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;
|
||||
|
||||
try {
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
const { exec } = require('node:child_process');
|
||||
const https = require('node:https');
|
||||
require('dotenv').config();
|
||||
const { uptimeURL, uptimeInterval } = process.env;
|
||||
|
||||
module.exports = {
|
||||
name: 'ready',
|
||||
|
@ -15,6 +18,7 @@ module.exports = {
|
|||
resolve(stdout);
|
||||
});
|
||||
});
|
||||
|
||||
const commandSize = client.commands.size;
|
||||
const clientTag = client.user.tag;
|
||||
const guildSize = client.guilds.cache.size;
|
||||
|
@ -26,7 +30,19 @@ module.exports = {
|
|||
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(`There is \x1b[33m${commandSize}\x1b[0m command loaded.`);
|
||||
console.log(`Running yt-dlp \x1b[33m${ytdlpVersion}\x1b[0m`);
|
||||
console.log(`Running yt-dlp \x1b[33m${ytdlpVersion.replace('\n', '')}\x1b[0m`);
|
||||
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,11 +1,9 @@
|
|||
// Require the necessary discord.js classes
|
||||
const fs = require('node:fs');
|
||||
const path = require('node:path');
|
||||
const { Client, Collection, Intents } = require('discord.js');
|
||||
require('dotenv').config();
|
||||
const { token } = process.env;
|
||||
|
||||
// Create a new client instance
|
||||
const client = new Client({ intents: [Intents.FLAGS.GUILDS] });
|
||||
|
||||
// Load commands from the commands folder
|
||||
|
@ -16,8 +14,6 @@ const commandFiles = fs.readdirSync(commandsPath).filter(file => file.endsWith('
|
|||
for (const file of commandFiles) {
|
||||
const filePath = path.join(commandsPath, file);
|
||||
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);
|
||||
}
|
||||
|
@ -37,5 +33,4 @@ for (const file of eventFiles) {
|
|||
}
|
||||
}
|
||||
|
||||
// Login to Discord with your client's token
|
||||
client.login(token);
|
||||
|
|
|
@ -23,7 +23,7 @@ git checkout slash
|
|||
npm install
|
||||
```
|
||||
|
||||
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.
|
||||
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.
|
||||
``node deploy-commands.js``
|
||||
|
||||
then you can just run it normally.
|
||||
|
|
Loading…
Reference in a new issue