Канал с новостями (в будущем)
This commit is contained in:
JonnyBro 2022-08-04 19:41:28 +05:00
parent 5f4c53b072
commit 8f0ac0cc64
7 changed files with 58 additions and 5 deletions

View file

@ -0,0 +1,44 @@
const Command = require("../../base/Command");
class Setnews extends Command {
constructor(client) {
super(client, {
name: "setnews",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: [],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const areNewsEnabled = Boolean(data.guild.plugins.news);
const sentChannel = await Resolvers.resolveChannel({
message,
search: args.join(" "),
channelType: "GUILD_TEXT"
});
if (areNewsEnabled && !sentChannel) {
data.guild.plugins.news = null;
data.guild.markModified("plugins.news");
await data.guild.save();
return message.success("administration/setnews:DISABLED");
} else {
const channel = sentChannel || message.channel;
data.guild.plugins.news = channel.id;
data.guild.markModified("plugins.news");
await data.guild.save();
return message.success("administration/setnews:ENABLED", {
channel: channel.toString()
});
}
}
}
module.exports = Setnews;

View file

@ -34,6 +34,7 @@ module.exports = mongoose.model("Guild", new Schema({
kick: false,
ban: false
},
news: false,
suggestions: false,
modlogs: false,
birthdays: false,

View file

@ -51,7 +51,7 @@ class Announcement extends BaseCommand {
client.guilds.cache.forEach(async guild => {
if (guild.id === "568120814776614924") return;
const channel = guild.channels.cache.find(g => g.id === guild?.data.plugins.welcome.channel);
const channel = guild.channels.cache.get(guild?.data.plugins.news);
await channel.send({
content: "||@everyone|| ВАЖНОЕ ОБЪЯВЛЕНИЕ!",
embeds: [embed]

View file

@ -4,7 +4,8 @@ module.exports = {
/* ID of Bot's user */
user: "XXXXXXXXXXX",
/* For the support server */
production: true, // Set to true for production
/* Set to true for production */
production: true,
support: {
id: "XXXXXXXXXXX", // The ID of the support server
logs: "XXXXXXXXXXX", // And the ID of the logs channel of your server (new servers for example)

View file

@ -0,0 +1,7 @@
{
"DESCRIPTION": "Установить канал для новостей бота",
"USAGE": "setnews (#канал)",
"EXAMPLES": "setnews #bot-news\nsetnews",
"ENABLED": "Поздравления включены в канале **{{channel}}**!",
"DISABLED": "Поздравления отключены!"
}

4
package-lock.json generated
View file

@ -1,12 +1,12 @@
{
"name": "jaba",
"version": "4.0pre1",
"version": "4.0pre3",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "jaba",
"version": "4.0pre1",
"version": "4.0pre3",
"license": "ISC",
"dependencies": {
"@discord-player/extractor": "^3.0.2",

View file

@ -1,6 +1,6 @@
{
"name": "jaba",
"version": "4.0pre1",
"version": "4.0pre3",
"description": "My Discord Bot",
"main": "index.js",
"private": true,