bug fixes/remove tweet channel
This commit is contained in:
6 files changed
+112
-25
No files matched your search
+1
-9
@@ -8,14 +8,6 @@ module.exports = {
|
|||||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||||
member: [],
|
member: [],
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
|
||||||
* @param {import("discord.js").Message} message
|
|
||||||
* @param {string[]} args
|
|
||||||
* @param {*} param3
|
|
||||||
*/
|
|
||||||
|
|
||||||
SlashCommand: {
|
SlashCommand: {
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
@@ -28,7 +20,7 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
* @param {require("../structures/QuarksBot")} client
|
||||||
* @param {import("discord.js").Message} message
|
* @param {import("discord.js").Message} message
|
||||||
* @param {string[]} args
|
* @param {string[]} args
|
||||||
* @param {*} param3
|
* @param {*} param3
|
||||||
|
|||||||
+1
-8
@@ -8,13 +8,6 @@ module.exports = {
|
|||||||
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||||
member: [],
|
member: [],
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
|
||||||
* @param {import("discord.js").MessageCreate} message
|
|
||||||
* @param {string[]} args
|
|
||||||
* @param {*} param3
|
|
||||||
*/
|
|
||||||
SlashCommand: {
|
SlashCommand: {
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
@@ -27,7 +20,7 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
* @param {require("../structures/QuarksBot")} client
|
||||||
* @param {import("discord.js").MessageCreate} message
|
* @param {import("discord.js").MessageCreate} message
|
||||||
* @param {string[]} args
|
* @param {string[]} args
|
||||||
* @param {*} param3
|
* @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"],
|
channel: ["VIEW_CHANNEL", "SEND_MESSAGES", "EMBED_LINKS"],
|
||||||
member: [],
|
member: [],
|
||||||
},
|
},
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
|
||||||
* @param {import("discord.js").MessageCreate} message
|
|
||||||
* @param {string[]} args
|
|
||||||
* @param {*} param3
|
|
||||||
*/
|
|
||||||
SlashCommand: {
|
SlashCommand: {
|
||||||
options: [
|
options: [
|
||||||
{
|
{
|
||||||
@@ -27,7 +20,7 @@ module.exports = {
|
|||||||
],
|
],
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {require("../structures/LinesPoliceCadBot")} client
|
* @param {require("../structures/QuarksBot")} client
|
||||||
* @param {import("discord.js").MessageCreate} message
|
* @param {import("discord.js").MessageCreate} message
|
||||||
* @param {string[]} args
|
* @param {string[]} args
|
||||||
* @param {*} param3
|
* @param {*} param3
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ class QuarksBot extends Client {
|
|||||||
this.Ready = false;
|
this.Ready = false;
|
||||||
|
|
||||||
this.ws.on("INTERACTION_CREATE", async (interaction) => {
|
this.ws.on("INTERACTION_CREATE", async (interaction) => {
|
||||||
|
if (interaction.type!=3) {
|
||||||
client.log("Interaction")
|
client.log("Interaction")
|
||||||
let GuildDB = await this.GetGuild(interaction.guild_id);
|
let GuildDB = await this.GetGuild(interaction.guild_id);
|
||||||
|
|
||||||
@@ -53,6 +54,7 @@ class QuarksBot extends Client {
|
|||||||
let cmd = client.commands.get(command);
|
let cmd = client.commands.get(command);
|
||||||
if (cmd.SlashCommand && cmd.SlashCommand.run)
|
if (cmd.SlashCommand && cmd.SlashCommand.run)
|
||||||
cmd.SlashCommand.run(this, interaction, args, { GuildDB });
|
cmd.SlashCommand.run(this, interaction, args, { GuildDB });
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
const client = this;
|
const client = this;
|
||||||
|
|||||||
Reference in new issue
Block a user