aboutsummaryrefslogtreecommitdiff
path: root/src/utils
diff options
context:
space:
mode:
authorMax Isom <[email protected]>2022-01-19 13:40:48 -0600
committerMax Isom <[email protected]>2022-01-19 13:40:48 -0600
commited4e7b5ceb146a9baa062426cc0fb1ec8844e056 (patch)
treeab01e87b7b0e075fc258ba9ce1fa5558f2eeec7b /src/utils
parent86e9936578d19c2115fc03acae1794532a09d62e (diff)
parentda72cd708bcfbba6e0a91da4878aaef10d2532e2 (diff)
downloadmuse-ed4e7b5ceb146a9baa062426cc0fb1ec8844e056.tar.xz
muse-ed4e7b5ceb146a9baa062426cc0fb1ec8844e056.zip
Merge branch 'master' into feature/slash-commands
Diffstat (limited to 'src/utils')
-rw-r--r--src/utils/channels.ts4
-rw-r--r--src/utils/create-database-url.ts7
-rw-r--r--src/utils/db.ts13
-rw-r--r--src/utils/log-banner.ts16
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;