mirror of
https://github.com/BluemediaDev/muse.git
synced 2025-05-11 20:31:35 +02:00
Create guild settings if not found (#911)
Co-authored-by: Max Isom <codetheweb@users.noreply.github.com>
This commit is contained in:
parent
6926e39c56
commit
02ee8aefc8
7 changed files with 25 additions and 27 deletions
|
@ -6,9 +6,9 @@ import {TYPES} from '../types.js';
|
|||
import GetSongs from '../services/get-songs.js';
|
||||
import {SongMetadata, STATUS} from './player.js';
|
||||
import PlayerManager from '../managers/player.js';
|
||||
import {prisma} from '../utils/db.js';
|
||||
import {buildPlayingMessageEmbed} from '../utils/build-embed.js';
|
||||
import {getMemberVoiceChannel, getMostPopularVoiceChannel} from '../utils/channels.js';
|
||||
import {getGuildSettings} from '../utils/get-guild-settings';
|
||||
|
||||
@injectable()
|
||||
export default class AddQueryToQueue {
|
||||
|
@ -34,11 +34,7 @@ export default class AddQueryToQueue {
|
|||
|
||||
const [targetVoiceChannel] = getMemberVoiceChannel(interaction.member as GuildMember) ?? getMostPopularVoiceChannel(interaction.guild!);
|
||||
|
||||
const settings = await prisma.setting.findUnique({where: {guildId}});
|
||||
|
||||
if (!settings) {
|
||||
throw new Error('Could not find settings for guild');
|
||||
}
|
||||
const settings = await getGuildSettings(guildId);
|
||||
|
||||
const {playlistLimit} = settings;
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ import {
|
|||
} from '@discordjs/voice';
|
||||
import FileCacheProvider from './file-cache.js';
|
||||
import debug from '../utils/debug.js';
|
||||
import {prisma} from '../utils/db.js';
|
||||
import {getGuildSettings} from '../utils/get-guild-settings';
|
||||
|
||||
export enum MediaSource {
|
||||
Youtube,
|
||||
|
@ -272,11 +272,7 @@ export default class {
|
|||
this.audioPlayer?.stop();
|
||||
this.status = STATUS.IDLE;
|
||||
|
||||
const settings = await prisma.setting.findUnique({where: {guildId: this.guildId}});
|
||||
|
||||
if (!settings) {
|
||||
throw new Error('Could not find settings for guild');
|
||||
}
|
||||
const settings = await getGuildSettings(this.guildId);
|
||||
|
||||
const {secondsToWaitAfterQueueEmpties} = settings;
|
||||
if (secondsToWaitAfterQueueEmpties !== 0) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue