Skip to content

Commit

Permalink
Fix debug and undebug commands crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
synzen committed Sep 2, 2021
1 parent 8892d03 commit de556d2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/commands/owner/debug.js
@@ -1,12 +1,15 @@
const ipc = require('../../util/ipc.js')
const createLogger = require('../../util/logger/create.js')
const DebugFeed = require('../../structs/db/DebugFeed')

module.exports = async (message) => {
const log = createLogger(message.guild.shard.id)
const content = message.content.split(' ')
if (content.length !== 2) return
const feedID = content[1]
ipc.send(ipc.TYPES.ADD_DEBUG_FEEDID, feedID)
const debugFeed = new DebugFeed({
feedId: feedID
})
await debugFeed.save()
log.owner({
user: message.author
}, `Added ${feedID} to debugging list for all shards.`)
Expand Down
9 changes: 7 additions & 2 deletions src/commands/owner/undebug.js
@@ -1,11 +1,16 @@
const ipc = require('../../util/ipc.js')
const createLogger = require('../../util/logger/create.js')
const DebugFeed = require('../../structs/db/DebugFeed')

module.exports = async (message) => {
const content = message.content.split(' ')
if (content.length !== 2) return
const feedID = content[1]
ipc.send(ipc.TYPES.REMOVE_DEBUG_FEEDID, feedID)
const found = await DebugFeed.getByQuery({
feedId: feedID
})
if (found) {
await found.delete()
}
const log = createLogger(message.guild.shard.id)
log.owner({
user: message.author
Expand Down

0 comments on commit de556d2

Please sign in to comment.