reset channel feature
This commit is contained in:
5 files changed
+482
-338
No files matched your search
@@ -36,7 +36,7 @@ module.exports = {
|
||||
if (!channel) return interaction.send({ content: `Uh Oh! The channel <#${args[0].value}> connot be found.` });
|
||||
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
|
||||
if (guild.server.hasCustomChannels==false) return interaction.send({ content: `There are no channels to be removed.` });
|
||||
if (!guild.server.allowedChannels.includes(channelid)) return interaction.send({ content: `The channel <#${args[0].value}> is not added to your roles.` });
|
||||
if (!guild.server.allowedChannels.includes(channelid)) return interaction.send({ content: `The channel <#${args[0].value}> is not added to your channels.` });
|
||||
for (let i = 0; i < guild.server.allowedChannels.length; i++) {
|
||||
if (guild.server.allowedChannels[i]==channelid) {
|
||||
if ((guild.server.allowedChannels.length-1)==0) {
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
const bitfieldCalculator = require('discord-bitfield-calculator');
|
||||
|
||||
module.exports = {
|
||||
name: "reset_channels",
|
||||
description: "Reset the configured channels for the bot",
|
||||
usage: "[channel]",
|
||||
permissions: {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: ["MANAGE_GUILD"],
|
||||
},
|
||||
SlashCommand: {
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").MessageCreate} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, interaction, args, { GuildDB }) => {
|
||||
const permissions = bitfieldCalculator.permissions(interaction.member.permissions);
|
||||
if (!permissions.includes("MANAGE_GUILD")) return interaction.send({ content: 'You don\'t have the permissions to use this command.' });
|
||||
|
||||
let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
|
||||
if (client.exists(guild.server.allowedChannels)&&guild.server.allowedChannels.includes(channelid)) return interaction.send({ content: `The channel <#${args[0].value}> has already been added.` });
|
||||
client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.allowedChannels":[]},$set:{"server.hasCustomChannels":false}},function(err, res) {
|
||||
if (err) throw err;
|
||||
return interaction.send({ content: `Successfully reset all configured channels` });
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -1,39 +0,0 @@
|
||||
const { EmbedBuilder } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
name: "setprefix",
|
||||
description: "Update prefix for the bot",
|
||||
usage: "[new Prefix]",
|
||||
permissions: {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: ["MANAGE_GUILD"],
|
||||
},
|
||||
options: [
|
||||
{
|
||||
name: "new-prefix",
|
||||
description: "Update prefix for the bot",
|
||||
value: "setprefix",
|
||||
type: 3,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
SlashCommand: {
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
run: async (client, interaction, args, { GuildDB }) => {
|
||||
if (GuildDB.customChannelStatus==true&&!GuildDB.allowedChannels.includes(interaction.channel_id)) {
|
||||
return interaction.send({ content: `You are not allowed to use the bot in this channel.` });
|
||||
}
|
||||
if (args[0].length<1) return interaction.send({ content: 'Your new prefix must be \`1\` character!' })
|
||||
client.dbo.collection("prefixes").updateOne({"server.serverID":GuildDB.serverID},{$set:{"server.prefix":args[0].value}},function(err, res) {
|
||||
if (err) throw err;
|
||||
interaction.send({ content: `The new prefix is now **\`${args[0].value}\`**` });
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
Generated
+448
-298
File diff suppressed because it is too large.
Load diff
@@ -12,6 +12,7 @@
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"colors": "^1.4.0",
|
||||
"discord-bitfield-calculator": "^1.2.0",
|
||||
"discord.js": "^14.3.0",
|
||||
"dotenv": "^16.0.3",
|
||||
"express": "^4.17.1",
|
||||
|
||||
Reference in new issue
Block a user