summaryrefslogtreecommitdiff
path: root/commands/setlogchannel.js
diff options
context:
space:
mode:
authorAndrew Lee <andrew@alee14.me>2025-02-25 23:13:39 -0500
committerAndrew Lee <andrew@alee14.me>2025-02-25 23:13:39 -0500
commit5777f96394444dab18a81d6f085ac81df3e62008 (patch)
tree47dc895e50fa95b52a894bf0806e1a6c1edc8818 /commands/setlogchannel.js
parentde5ee661cad7b1fef0f319cbaccd888cb75a1dd4 (diff)
downloadAleeBot-2.13.0.tar.gz
AleeBot-2.13.0.tar.bz2
AleeBot-2.13.0.zip
2.13 Release (finally); Added more API entries; Proper loggingv2.13.0
Diffstat (limited to 'commands/setlogchannel.js')
-rw-r--r--commands/setlogchannel.js25
1 files changed, 17 insertions, 8 deletions
diff --git a/commands/setlogchannel.js b/commands/setlogchannel.js
index c04e926..d989f8b 100644
--- a/commands/setlogchannel.js
+++ b/commands/setlogchannel.js
@@ -17,21 +17,30 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* *************************************/
-const guildDB = require ('../models/guild-settings')
-module.exports.run = async (client, message) => {
+const { guildSettings } = require ('../models/guild-settings')
+module.exports.run = async (client, message, args) => {
//This will be replaced in the future possibly
if (!message.member.permissions.has('MANAGE_GUILD')) return message.reply('It looks like that you can\'t manage this server.');
- const channel = await message.mentions.channels.first().id;
- const [ guild ] = await guildDB.findOrCreate({ where: { id: message.guild.id } } )
+
+ let channel;
+
+ if (message.mentions.channels.first()) {
+ channel = message.mentions.channels.first().id;
+ } else if (args[0] && message.guild.channels.cache.has(args[0])) {
+ channel = args[0];
+ } else {
+ return await message.reply('Please enter a valid channel ID.')
+ }
+
+ const [ guild ] = await guildSettings.findOrCreate({ where: { guildID: message.guild.id } } )
if (!channel) {
message.reply('No channel has been set, disabling the logging channel feature...');
- await guild.update({ channelId: null } );
+ await guild.update({ logChannelID: null } );
} else {
- await guild.update({ channelId: message.guild.id } ) ;
+ await guild.update({ logChannelID: channel } );
+ await message.reply(`Logging channel has been set to <#${channel}>`);
}
-
- await message.reply(`Logging channel has been set to <#${channel}>`);
};
exports.conf = {