bug fixes/remove tweet channel
This commit is contained in:
6 files changed
+137
-50
No files matched your search
+1
-9
@@ -8,14 +8,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
@@ -28,7 +20,7 @@ module.exports = {
|
||||
],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {require("../structures/QuarksBot")} client
|
||||
* @param {import("discord.js").Message} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
|
||||
+1
-8
@@ -8,13 +8,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").MessageCreate} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
@@ -27,7 +20,7 @@ module.exports = {
|
||||
],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {require("../structures/QuarksBot")} client
|
||||
* @param {import("discord.js").MessageCreate} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
const { MessageEmbed, MessageActionRow, MessageButton } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
name: "removetweetchannel",
|
||||
description: "Remove tweet channel",
|
||||
usage: "",
|
||||
permissions: {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: ["MANAGE_GUILD"],
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/QuarksBot")} client
|
||||
* @param {import("discord.js").MessageCreate} 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(`You are not allowed to use the bot in this channel.`);
|
||||
}
|
||||
|
||||
let message = new MessageEmbed()
|
||||
.setTitle('Are you sure you want to stop using this channel for tweets?')
|
||||
.setColor(client.config.EmbedColor)
|
||||
|
||||
let row = new MessageActionRow()
|
||||
.addComponents(
|
||||
new MessageButton()
|
||||
.setCustomId(`yes`)
|
||||
.setLabel("Yes")
|
||||
.setStyle("DANGER"),
|
||||
new MessageButton()
|
||||
.setCustomId(`no`)
|
||||
.setLabel("No")
|
||||
.setStyle("SUCCESS")
|
||||
)
|
||||
|
||||
interaction.send({ embeds: [message], components: [row] });
|
||||
|
||||
client.once("interactionCreate", ButtonInteraction => {
|
||||
if (ButtonInteraction.message.interaction &&
|
||||
ButtonInteraction.message.interaction.commandName!='removetweetchannel') return;
|
||||
let queryString = ButtonInteraction.customId;
|
||||
let action = ''
|
||||
if (queryString=='yes') {
|
||||
action = 'removed';
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":ButtonInteraction.guild.id},{$set:{"server.tweetChannel":null}},function(err, res) {
|
||||
if (err) throw err;
|
||||
});
|
||||
} else if (queryString=='no') {
|
||||
action = 'kept';
|
||||
}
|
||||
return ButtonInteraction.update({ content: `Successfully ${action} channel.`, embeds: [], components: [] });
|
||||
});
|
||||
return;
|
||||
},
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
const { MessageEmbed } = require('discord.js');
|
||||
|
||||
module.exports = {
|
||||
name: "settweetchannel",
|
||||
description: "Select a channel to send tweets",
|
||||
usage: "[channel]",
|
||||
permissions: {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: ["MANAGE_GUILD"],
|
||||
},
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
name: "channel",
|
||||
description: "Channel to add to allowed channles",
|
||||
value: "channel",
|
||||
type: 7,
|
||||
required: true,
|
||||
},
|
||||
],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/QuarksBot")} client
|
||||
* @param {import("discord.js").MessageCreate} 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(`You are not allowed to use the bot in this channel.`);
|
||||
}
|
||||
|
||||
let channelid = args[0].value;
|
||||
let channel = client.channels.cache.get(channelid);
|
||||
if (!channel) return interaction.send(`Cannot find that channel.`);
|
||||
if (channel.type=="voice") return interaction.send(`Connot set voice channel to preferred channel.`);
|
||||
if (channel.deleted) return interaction.send(`Connot set deleted channel to preferred channel.`);
|
||||
let guild = await client.dbo.collection("guilds").findOne({"server.serverID":interaction.guild.id}).then(guild => guild);
|
||||
if (client.exists(guild.server.tweetChannel)&&guild.server.tweetChannel==channelid) return interaction.send(`The channel <#${args[0].value}> has already been set for tweets.`);
|
||||
client.dbo.collection("guilds").updateOne({"server.serverID":interaction.guild.id},{$set:{"server.tweetChannel":channelid}},function(err, res) {
|
||||
if (err) throw err;
|
||||
return interaction.send(`Successfully set <#${args[0].value}> for tweets.`);
|
||||
});
|
||||
},
|
||||
},
|
||||
}
|
||||
+1
-8
@@ -8,13 +8,6 @@ module.exports = {
|
||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||
member: [],
|
||||
},
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {import("discord.js").MessageCreate} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
*/
|
||||
SlashCommand: {
|
||||
options: [
|
||||
{
|
||||
@@ -27,7 +20,7 @@ module.exports = {
|
||||
],
|
||||
/**
|
||||
*
|
||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
||||
* @param {require("../structures/QuarksBot")} client
|
||||
* @param {import("discord.js").MessageCreate} message
|
||||
* @param {string[]} args
|
||||
* @param {*} param3
|
||||
|
||||
Reference in new issue
Block a user