simnJS
simnJS
Explore posts from servers
SIASapphire - Imagine a framework
Created by simnJS on 8/20/2024 in #sapphire-support
Using sapphire paginator is it possible to customize the pages names ?
No description
60 replies
SIASapphire - Imagine a framework
Created by simnJS on 8/6/2024 in #sapphire-support
Is there a way to hide command if the user doesn't have the precondition ?
No description
17 replies
PPrisma
Created by simnJS on 8/5/2024 in #help-and-questions
Issue with prisma optimize
Hello, I have an issue with prisma optimize Error: prisma:client:operation span is expected to be entered in the client extension when tracing is enabled at Array.$allOperations (C:\Users\simon\Desktop\diamond-presence\node_modules@prisma\extension-optimize\dist\index.js:4:1103) at C:\Users\simon\Desktop\diamond-presence\node_modules@prisma\client\runtime\edge.js:5:5358 at i (C:\Users\simon\Desktop\diamond-presence\node_modules@prisma\client\runtime\edge.js:20:963) at PrismaPromise.then (C:\Users\simon\Desktop\diamond-presence\node_modules@prisma\client\runtime\edge.js:20:1038) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) Node.js v20.15.0
import './lib/setup';
import { PrismaClient } from '@prisma/client/edge';
import { withOptimize } from '@prisma/extension-optimize';
import { container, LogLevel, SapphireClient } from '@sapphire/framework';
import { GatewayIntentBits } from 'discord.js';

// Extend Prisma Client with the optimization extension
const prisma = new PrismaClient().$extends(withOptimize());

// Define a correct type for the extended Prisma Client
type ExtendedPrismaClient = PrismaClient & ReturnType<typeof withOptimize>;

// Sapphire client setup
const client = new SapphireClient({
defaultPrefix: '!',
caseInsensitiveCommands: true,
logger: {
level: LogLevel.Debug,
},
intents: [
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.Guilds,
GatewayIntentBits.MessageContent,
],
loadMessageCommandListeners: true,
});

// Main function to start the bot
const main = async () => {
try {
client.logger.info('Logging in');
await client.login();
client.logger.info('Logged in');
} catch (error) {
client.logger.fatal(error);
await client.destroy();
process.exit(1);
}
};

// Ensure the container has the correct type
declare module '@sapphire/pieces' {
interface Container {
database: ExtendedPrismaClient;
}
}

// Assign the database to the container
container.database = prisma as ExtendedPrismaClient;

// Execute the main function
void main();
import './lib/setup';
import { PrismaClient } from '@prisma/client/edge';
import { withOptimize } from '@prisma/extension-optimize';
import { container, LogLevel, SapphireClient } from '@sapphire/framework';
import { GatewayIntentBits } from 'discord.js';

// Extend Prisma Client with the optimization extension
const prisma = new PrismaClient().$extends(withOptimize());

// Define a correct type for the extended Prisma Client
type ExtendedPrismaClient = PrismaClient & ReturnType<typeof withOptimize>;

// Sapphire client setup
const client = new SapphireClient({
defaultPrefix: '!',
caseInsensitiveCommands: true,
logger: {
level: LogLevel.Debug,
},
intents: [
GatewayIntentBits.DirectMessages,
GatewayIntentBits.GuildMessages,
GatewayIntentBits.Guilds,
GatewayIntentBits.MessageContent,
],
loadMessageCommandListeners: true,
});

// Main function to start the bot
const main = async () => {
try {
client.logger.info('Logging in');
await client.login();
client.logger.info('Logged in');
} catch (error) {
client.logger.fatal(error);
await client.destroy();
process.exit(1);
}
};

// Ensure the container has the correct type
declare module '@sapphire/pieces' {
interface Container {
database: ExtendedPrismaClient;
}
}

// Assign the database to the container
container.database = prisma as ExtendedPrismaClient;

// Execute the main function
void main();
26 replies
SIASapphire - Imagine a framework
Created by simnJS on 7/2/2024 in #sapphire-support
Terminal Crash
Every time I stop a sapphire project using watch my terminal crash
15 replies
PPrisma
Created by simnJS on 5/14/2024 in #help-and-questions
Error
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init

generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}

model Bot {
id String @id @default(cuid())
commandExecutedCount Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model Guild {
id String @id
name String
users User[]
}

model User {
id String @id
anniversaire Anniversary[]
guildId String @db.VarChar(191)
guild Guild @relation(fields: [guildId], references: [id])

@@unique([id, guildId])
}

model Anniversary {
id Int @id @default(autoincrement())
date DateTime
userId String @unique @db.VarChar(191)
user User @relation(fields: [userId], references: [id])
}
// This is your Prisma schema file,
// learn more about it in the docs: https://pris.ly/d/prisma-schema

// Looking for ways to speed up your queries, or scale easily with your serverless or edge functions?
// Try Prisma Accelerate: https://pris.ly/cli/accelerate-init

generator client {
provider = "prisma-client-js"
}

datasource db {
provider = "mysql"
url = env("DATABASE_URL")
}

model Bot {
id String @id @default(cuid())
commandExecutedCount Int @default(0)
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
}

model Guild {
id String @id
name String
users User[]
}

model User {
id String @id
anniversaire Anniversary[]
guildId String @db.VarChar(191)
guild Guild @relation(fields: [guildId], references: [id])

@@unique([id, guildId])
}

model Anniversary {
id Int @id @default(autoincrement())
date DateTime
userId String @unique @db.VarChar(191)
user User @relation(fields: [userId], references: [id])
}
I got this error : Error: La clé est trop longue. Longueur maximale: 1000 0: sql_schema_connector::apply_migration::migration_step with step=CreateIndex { table_id: (Some(TableId(3)), TableId(2)), index_id: IndexId(3), from_drop_and_recreate: false } at schema-engine\connectors\sql-schema-connector\src\apply_migration.rs:21 1: sql_schema_connector::apply_migration::apply_migration at schema-engine\connectors\sql-schema-connector\src\apply_migration.rs:10 2: schema_core::state::SchemaPush at schema-engine\core\src\state.rs:434
2 replies
SIASapphire - Imagine a framework
Created by simnJS on 5/6/2024 in #sapphire-support
Why did I need to restart my discord everytime when I create a new command using sapphire ?
Can I solve it ?
6 replies