forked from Supositware/Haha-Yes
About and donate commands
This commit is contained in:
parent
cffa0ea718
commit
c980594974
4 changed files with 90 additions and 0 deletions
56
commands/utility/about.js
Normal file
56
commands/utility/about.js
Normal file
|
@ -0,0 +1,56 @@
|
|||
import { SlashCommandBuilder } from '@discordjs/builders';
|
||||
import { MessageEmbed } from 'discord.js';
|
||||
import { exec } from 'node:child_process';
|
||||
import db from '../../models/index.js';
|
||||
const donator = db.donator;
|
||||
|
||||
import dotenv from 'dotenv';
|
||||
dotenv.config();
|
||||
const { ownerId } = process.env;
|
||||
|
||||
export default {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('about')
|
||||
.setDescription('About me (The bot)'),
|
||||
async execute(interaction) {
|
||||
const Donator = await donator.findAll({ order: ['id'] });
|
||||
const client = interaction.client;
|
||||
const tina = await client.users.fetch('336492042299637771');
|
||||
const owner = await client.users.fetch('267065637183029248');
|
||||
const maintainer = await client.users.fetch(ownerId);
|
||||
|
||||
let description = `This bot is made using [discord.js](https://github.com/discordjs/discord.js)\nThanks to ${tina.tag} (336492042299637771) for inspiring me for making this bot!\n\nThe people who donated for the bot <3\n`;
|
||||
|
||||
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) {
|
||||
description += `**${user.tag} (${user.id}) | ${Donator[i].get('comment')}**\n`;
|
||||
}
|
||||
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';
|
||||
}
|
||||
|
||||
// description += '\nThanks to Jetbrains for providing their IDE!';
|
||||
|
||||
exec('git rev-parse --short HEAD', (err, stdout) => {
|
||||
const aboutEmbed = new MessageEmbed()
|
||||
.setColor(interaction.member ? interaction.member.displayHexColor : 'NAVY')
|
||||
.setAuthor({ name: client.user.tag, iconURL: client.user.displayAvatarURL(), url: 'https://libtar.de' })
|
||||
.setTitle('About me')
|
||||
.setDescription(description)
|
||||
.addField('Current commit', stdout)
|
||||
.addField('Current maintainer: ', `${maintainer.tag} (${ownerId})`)
|
||||
.addField('Gitea (Main)', 'https://git.namejeff.xyz/Supositware/Haha-Yes', true)
|
||||
.addField('Github (Mirror)', 'https://github.com/Supositware/Haha-yes', true)
|
||||
.setFooter({ text: `Original bot made by ${owner.tag} (267065637183029248)` });
|
||||
|
||||
interaction.reply({ embeds: [aboutEmbed] });
|
||||
});
|
||||
},
|
||||
};
|
22
commands/utility/donate.js
Normal file
22
commands/utility/donate.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
import { SlashCommandBuilder } from '@discordjs/builders';
|
||||
import { MessageEmbed } from 'discord.js';
|
||||
import donations from '../../json/donations.json' assert {type: 'json'};
|
||||
|
||||
export default {
|
||||
data: new SlashCommandBuilder()
|
||||
.setName('donate')
|
||||
.setDescription('Show donation link for the bot.'),
|
||||
async execute(interaction) {
|
||||
let desc = 'If you decide to donate, please do /feedback to let the owner know about it so he can put you in the about and donator command.';
|
||||
donations.forEach(m => {
|
||||
desc += `\n${m}`;
|
||||
});
|
||||
|
||||
const Embed = new MessageEmbed()
|
||||
.setColor(interaction.member ? interaction.member.displayHexColor : 'NAVY')
|
||||
.setTitle('Donation link')
|
||||
.setDescription(desc);
|
||||
|
||||
return interaction.reply({ embeds: [Embed] });
|
||||
},
|
||||
};
|
4
json/donations.json
Normal file
4
json/donations.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
[
|
||||
"ETH adresse: 0x9F3FB51e4C295d774a0861b9D6796D12525dD81d",
|
||||
"XMR adresse: 87PdPzX6u2nE1ucHDKQtGk2BE2zS42LwPS886KHUqCPoK5TDfkgnin4ZByb3zw5F5acYvbFWcjC83CJWVB6bXkfjAhkJkqU"
|
||||
]
|
|
@ -73,6 +73,14 @@ const commands = [
|
|||
new SlashCommandBuilder()
|
||||
.setName('donator')
|
||||
.setDescription('All the people who donated for this bot <3'),
|
||||
|
||||
new SlashCommandBuilder()
|
||||
.setName('donate')
|
||||
.setDescription('Show donation link for the bot.'),
|
||||
|
||||
new SlashCommandBuilder()
|
||||
.setName('about')
|
||||
.setDescription('About me (The bot)'),
|
||||
]
|
||||
.map(command => command.toJSON());
|
||||
|
||||
|
|
Loading…
Reference in a new issue