Haha-Yes/commands/utility/about.js

64 lines
2.6 KiB
JavaScript
Raw Normal View History

import { SlashCommandBuilder } from 'discord.js';
import { EmbedBuilder } from 'discord.js';
import { execFile } from 'node:child_process';
2022-08-17 20:53:08 +02:00
import db from '../../models/index.js';
const donator = db.donator;
2022-09-12 11:21:30 +02:00
const { ownerId, uptimePage } = process.env;
2022-08-17 20:53:08 +02:00
export default {
data: new SlashCommandBuilder()
.setName('about')
.setDescription('About me (The bot)'),
category: 'utility',
2022-08-17 20:53:08 +02:00
async execute(interaction) {
const Donator = await donator.findAll({ order: ['id'] });
const client = interaction.client;
const tina = await client.users.fetch('336492042299637771');
2023-04-10 14:48:57 +02:00
const creator = await client.users.fetch('267065637183029248');
2022-08-17 20:53:08 +02:00
const maintainer = await client.users.fetch(ownerId);
2022-08-31 22:32:12 +02:00
let description = 'I\'m a fun multipurpose bot made using [discord.js](https://github.com/discordjs/discord.js)'
+ '\nFor a better experience use the slash commands!\n\nThe people who donated for the bot <3\n';
2022-08-17 20:53:08 +02:00
if (Donator[0]) {
for (let i = 0; i < Donator.length; i++) {
const user = await client.users.fetch(Donator[i].get('userID').toString());
if (user !== null) {
2023-12-12 21:18:50 +01:00
description += `**${user.username} (${user.id}) | ${Donator[i].get('comment')}**\n`;
2022-08-17 20:53:08 +02:00
}
else {
description += `**A user of discord (${user.id}) | ${Donator[i].get('comment')} (This user no longer share a server with the bot)**\n`;
}
}
}
else {
description += 'No one :(\n';
}
2023-12-12 21:18:50 +01:00
description += `\nThanks to ${tina.username} (336492042299637771) for inspiring me for making this bot!`;
2022-08-31 22:32:12 +02:00
2022-08-17 20:53:08 +02:00
// description += '\nThanks to Jetbrains for providing their IDE!';
execFile('git', ['rev-parse', '--short', 'HEAD'], (err, stdout) => {
const aboutEmbed = new EmbedBuilder()
2022-09-08 16:56:15 +02:00
.setColor(interaction.member ? interaction.member.displayHexColor : 'Navy')
2023-12-12 21:18:50 +01:00
.setAuthor({ name: client.user.username, iconURL: client.user.displayAvatarURL(), url: 'https://libtar.de' })
2022-08-17 20:53:08 +02:00
.setTitle('About me')
.setDescription(description)
.addFields(
{ name: 'Current commit', value: stdout },
2023-12-12 21:18:50 +01:00
{ name: 'Current maintainer', value: `${maintainer.username} (${ownerId})` },
{ name: 'Gitea (Main)', value: 'https://git.namejeff.xyz/Supositware/Haha-Yes', inline: true },
{ name: 'Github (Mirror)', value: 'https://github.com/Supositware/Haha-yes', inline: true },
2022-09-12 11:21:30 +02:00
{ name: 'Privacy Policy', value: 'https://libtar.de/discordprivacy.txt', inline: true },
{ name: 'Status page', value: uptimePage.toString(), inline: true },
)
2023-12-12 21:46:41 +01:00
.setFooter({ text: `Original bot made by ${creator.username} (267065637183029248)` });
2022-08-17 20:53:08 +02:00
interaction.reply({ embeds: [aboutEmbed] });
});
},
};