mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
4.0pre3
Канал с новостями (в будущем)
This commit is contained in:
parent
5f4c53b072
commit
8f0ac0cc64
7 changed files with 58 additions and 5 deletions
44
TO REWRITE/Administration/setnews.js
Normal file
44
TO REWRITE/Administration/setnews.js
Normal 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;
|
|
@ -34,6 +34,7 @@ module.exports = mongoose.model("Guild", new Schema({
|
|||
kick: false,
|
||||
ban: false
|
||||
},
|
||||
news: false,
|
||||
suggestions: false,
|
||||
modlogs: false,
|
||||
birthdays: false,
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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)
|
||||
|
|
7
languages/ru-RU/administration/setnews.json
Normal file
7
languages/ru-RU/administration/setnews.json
Normal file
|
@ -0,0 +1,7 @@
|
|||
{
|
||||
"DESCRIPTION": "Установить канал для новостей бота",
|
||||
"USAGE": "setnews (#канал)",
|
||||
"EXAMPLES": "setnews #bot-news\nsetnews",
|
||||
"ENABLED": "Поздравления включены в канале **{{channel}}**!",
|
||||
"DISABLED": "Поздравления отключены!"
|
||||
}
|
4
package-lock.json
generated
4
package-lock.json
generated
|
@ -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",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "jaba",
|
||||
"version": "4.0pre1",
|
||||
"version": "4.0pre3",
|
||||
"description": "My Discord Bot",
|
||||
"main": "index.js",
|
||||
"private": true,
|
||||
|
|
Loading…
Reference in a new issue