Browse Source

Make sure bot logs channel gets created even if it's not found in database

master
Abheek Dhawan 4 years ago
parent
commit
ad4b019eea
  1. 16
      index.js

16
index.js

@ -104,8 +104,22 @@ async function startLogs(message) {
// Add the ID of the "#bot-logs" channel to the database
message.reply(`channel ${channel} created!`)
collection.updateOne({ guild_id: message.guild.id }, { $set: { "bot_logs_id": `${channel.id}` } });
}).catch(message.reply(`unable to create channel :(`));
}).catch(console.error);
}
} else {
// Create "#bot-logs" text channel to track message deletes, edits, and channel creations
message.guild.channels.create('bot-logs', {
type: 'text',
// Remove view permissions from "@everyone"
permissionOverwrites: [{
id: message.guild.id,
deny: ['VIEW_CHANNEL'],
}]
}).then(channel => {
// Add the ID of the "#bot-logs" channel to the database
message.reply(`channel ${channel} created!`)
collection.updateOne({ guild_id: message.guild.id }, { $set: { "bot_logs_id": `${channel.id}` } });
}).catch(console.error);
}
});
}

Loading…
Cancel
Save