Version Estable

This commit is contained in:
2025-09-17 13:33:10 -05:00
commit bf6a7e3024
39 changed files with 2537 additions and 0 deletions

49
src/core/client.ts Normal file
View File

@@ -0,0 +1,49 @@
// @ts-ignore
import { Client, GatewayIntentBits } from 'discord.js';
// 1. Importa PrismaClient
// @ts-ignore
import { PrismaClient } from '@prisma/client';
process.loadEnvFile();
class Amayo extends Client {
public key: string;
// 2. Declara la propiedad prisma
public prisma: PrismaClient;
constructor() {
super({
intents: [
GatewayIntentBits.Guilds,
GatewayIntentBits.GuildMembers,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.MessageContent,
GatewayIntentBits.GuildMessageTyping
],
rest: {
retries: 10
}
});
this.key = process.env.TOKEN ?? '';
// 3. Instancia PrismaClient en el constructor
this.prisma = new PrismaClient();
}
async play () {
if(!this.key) {
return console.error('No key provided');
} else {
// Ejemplo de cómo usarías prisma antes de iniciar sesión
try {
await this.prisma.$connect();
console.log('Successfully connected to the database.');
await this.login(this.key);
} catch (error) {
console.error('Failed to connect to the database:', error);
}
}
}
}
export default Amayo;