add/remove channels with allowed channels

This commit is contained in:
SowinskiBraeden committed 2022-07-06 12:00:02 -07:00
1 parent 8a5986a620
commit 250061756b
3 files changed
+117 -13

No files matched your search

+22 -2
View File
@@ -17,12 +17,12 @@ module.exports = {
type: 3,
required: true,
choices: [
{ name: "action", value: "action" }, { name: "tweet", value: "tweet" },
{ name: "action", value: "action" }, { name: "tweet", value: "tweet" }, { name: "allowed", value: "allowed" },
],
},
{
name: "channel",
description: "Channel to send tweets",
description: "Channel to send actions/tweets",
value: "channel",
type: 7,
required: true,
@@ -49,6 +49,26 @@ module.exports = {
if (channel.deleted) return interaction.send(`Connot set deleted channel to ${channelType} channel.`);
let guild = await client.dbo.collection("guilds").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
if (channelType == "allowed") {
client.dbo.collection("guilds").updateOne({"server.serverID":GuildDB.serverID}, {$push:{"server.allowedChannels": channelid}}, function (err, res) {
if (err) {
client.log(err);
let embed = new MessageEmbed()
.setTitle(err)
.setColor("RED")
return interaction.send({ embeds: [embed] });
}
});
let successEmbed = new MessageEmbed()
.setColor("GREEN")
.setTitle("Success")
.setDescription(`Successfully set <#${channelid}> as an allowed channel.`);
return interaction.send({ embeds: [successEmbed] });
}
let channelSetting, query;
if (channelType == "action") {
channelSetting = guild.server.actionChannel;