Skip to content

Commit

Permalink
fix(music): Fix build error
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Crespi committed Mar 24, 2020
1 parent 9e07b8c commit 17812bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/music/models/MusicConnection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,14 @@ export class MusicConnection {
if (this.player) {
this.switchChannel(channel);
} else {
this.settings = await this.service.client.cache.guilds.get(this.guild.id);
this.settings = await this.service.getGuildSettings(this.guild.id);
this.volume = this.settings.musicVolume;

this.voiceChannel = channel;
this.player = (await channel.join({})) as LavaPlayer;
this.player.setVolume(this.volume);
this.player.on('warn', error => console.error(error));
this.player.on('error', error => console.error(error));
this.player.on('warn', (error) => console.error(error));
this.player.on('error', (error) => console.error(error));
this.player.on('speakingStart', this.onSpeakingStart);
this.player.on('speakingStop', this.onSpeakingEnd);
this.player.on('stateUpdate', this.onStateUpdate);
Expand Down Expand Up @@ -224,7 +224,7 @@ export class MusicConnection {

this.doPlayNext = false;

return new Promise<void>(async resolve => {
return new Promise<void>(async (resolve) => {
this.doneCallback = async () => {
this.doPlayNext = true;
resolve();
Expand Down Expand Up @@ -252,7 +252,7 @@ export class MusicConnection {
if (next) {
if (this.settings.announceNextSong) {
let sanitizedTitle = next.title || '';
IGNORED_ANNOUNCEMENT_WORDS.forEach(word => (sanitizedTitle = sanitizedTitle.replace(word, '')));
IGNORED_ANNOUNCEMENT_WORDS.forEach((word) => (sanitizedTitle = sanitizedTitle.replace(word, '')));
if (sanitizedTitle) {
await this.playAnnouncement(this.settings.announcementVoice, 'Playing: ' + sanitizedTitle).catch(
() => undefined
Expand Down
4 changes: 4 additions & 0 deletions src/music/services/MusicService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,4 +178,8 @@ export class MusicService extends IMService {
);
return data.tracks;
}

public async getGuildSettings(guildId: string) {
return this.client.cache.guilds.get(guildId);
}
}

0 comments on commit 17812bb

Please sign in to comment.