diff options
Diffstat (limited to 'src/utils')
| -rw-r--r-- | src/utils/channels.ts | 4 | ||||
| -rw-r--r-- | src/utils/create-database-url.ts | 7 | ||||
| -rw-r--r-- | src/utils/db.ts | 13 | ||||
| -rw-r--r-- | src/utils/log-banner.ts | 16 |
4 files changed, 27 insertions, 13 deletions
diff --git a/src/utils/channels.ts b/src/utils/channels.ts index 2d074b4..f4e576a 100644 --- a/src/utils/channels.ts +++ b/src/utils/channels.ts @@ -42,10 +42,10 @@ export const getMostPopularVoiceChannel = (guild: Guild): [VoiceChannel, number] for (const [_, channel] of guild.channels.cache) { if (channel.type === 'GUILD_VOICE') { - const size = getSizeWithoutBots(channel as VoiceChannel); + const size = getSizeWithoutBots(channel); voiceChannels.push({ - channel: channel as VoiceChannel, + channel, n: size, }); } diff --git a/src/utils/create-database-url.ts b/src/utils/create-database-url.ts new file mode 100644 index 0000000..becc973 --- /dev/null +++ b/src/utils/create-database-url.ts @@ -0,0 +1,7 @@ +import {join} from 'path'; + +export const createDatabasePath = (directory: string) => join(directory, 'db.sqlite'); + +const createDatabaseUrl = (directory: string) => `file:${createDatabasePath(directory)}`; + +export default createDatabaseUrl; diff --git a/src/utils/db.ts b/src/utils/db.ts index 15a2d79..b630320 100644 --- a/src/utils/db.ts +++ b/src/utils/db.ts @@ -1,12 +1,3 @@ -import {Sequelize} from 'sequelize-typescript'; -import path from 'path'; -import {DATA_DIR} from '../services/config.js'; -import {FileCache, KeyValueCache, Settings, Shortcut} from '../models/index.js'; +import Prisma from '@prisma/client'; -export const sequelize = new Sequelize({ - dialect: 'sqlite', - database: 'muse', - storage: path.join(DATA_DIR, 'db.sqlite'), - models: [FileCache, KeyValueCache, Settings, Shortcut], - logging: false, -}); +export const prisma = new Prisma.PrismaClient(); diff --git a/src/utils/log-banner.ts b/src/utils/log-banner.ts new file mode 100644 index 0000000..0ad6466 --- /dev/null +++ b/src/utils/log-banner.ts @@ -0,0 +1,16 @@ +import {makeLines} from 'nodesplash'; +import metadata from '../../package.json'; + +const logBanner = () => { + console.log(makeLines({ + user: 'codetheweb', + repository: 'muse', + version: metadata.version, + paypalUser: 'codetheweb', + githubSponsor: 'codetheweb', + madeByPrefix: 'Made with 🎶 by ', + }).join('\n')); + console.log('\n'); +}; + +export default logBanner; |
