Skip to content

Commit

Permalink
Properly delete VCs from DB on match completion
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalissaac committed Jul 3, 2020
1 parent 51a0069 commit b335f3f
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/commands/match.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const CONSTANTS = require('../constants')
const moment = require('moment-timezone')
const admin = require('firebase-admin')

module.exports = exports = {
name: 'match',
Expand Down Expand Up @@ -122,10 +123,10 @@ const start = async (message, GLOBALS) => {
})

teamAMembers.each(player => {
player.voice.setChannel(teamAVoiceChannel)
player.voice.setChannel(teamAVoiceChannel).catch()
})
teamBMembers.each(player => {
player.voice.setChannel(teamBVoiceChannel)
player.voice.setChannel(teamBVoiceChannel).catch()
})
}
}
Expand Down Expand Up @@ -165,8 +166,8 @@ const score = async (message, GLOBALS) => {

matchInformation.status = 'completed'
matchInformation.score = [matchScore.split('-')[0], matchScore.split('-')[1]]
matchInformation.teamAVoiceChannel = undefined
matchInformation.teamBVoiceChannel = undefined
matchInformation.teamAVoiceChannel = admin.firestore.FieldValue.delete()
matchInformation.teamBVoiceChannel = admin.firestore.FieldValue.delete()

matchInformationRef.update(matchInformation)

Expand Down

0 comments on commit b335f3f

Please sign in to comment.