mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-08-05 23:43:30 +02:00
Setup and migrate to Prisma (#456)
This commit is contained in:
parent
129d121364
commit
51d378e4cb
30 changed files with 605 additions and 273 deletions
|
@ -10,7 +10,7 @@ import LoadingMessage from '../utils/loading-message.js';
|
|||
import errorMsg from '../utils/error-msg.js';
|
||||
import Command from '.';
|
||||
import GetSongs from '../services/get-songs.js';
|
||||
import Settings from '../models/settings.js';
|
||||
import {prisma} from '../utils/db.js';
|
||||
|
||||
@injectable()
|
||||
export default class implements Command {
|
||||
|
@ -41,8 +41,15 @@ export default class implements Command {
|
|||
// eslint-disable-next-line complexity
|
||||
public async execute(msg: Message, args: string[]): Promise<void> {
|
||||
const [targetVoiceChannel] = getMemberVoiceChannel(msg.member!) ?? getMostPopularVoiceChannel(msg.guild!);
|
||||
const settings = await Settings.findByPk(msg.guild!.id);
|
||||
const {playlistLimit} = settings!;
|
||||
const setting = await prisma.setting.findUnique({
|
||||
where: {
|
||||
guildId: msg.guild!.id,
|
||||
}});
|
||||
if (!setting) {
|
||||
throw new Error(`Couldn't find settings for guild ${msg.guild!.id}`);
|
||||
}
|
||||
|
||||
const {playlistLimit} = setting;
|
||||
|
||||
const res = new LoadingMessage(msg.channel as TextChannel);
|
||||
await res.start();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue