mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-25 22:55:00 +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,
|
kick: false,
|
||||||
ban: false
|
ban: false
|
||||||
},
|
},
|
||||||
|
news: false,
|
||||||
suggestions: false,
|
suggestions: false,
|
||||||
modlogs: false,
|
modlogs: false,
|
||||||
birthdays: false,
|
birthdays: false,
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Announcement extends BaseCommand {
|
||||||
|
|
||||||
client.guilds.cache.forEach(async guild => {
|
client.guilds.cache.forEach(async guild => {
|
||||||
if (guild.id === "568120814776614924") return;
|
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({
|
await channel.send({
|
||||||
content: "||@everyone|| ВАЖНОЕ ОБЪЯВЛЕНИЕ!",
|
content: "||@everyone|| ВАЖНОЕ ОБЪЯВЛЕНИЕ!",
|
||||||
embeds: [embed]
|
embeds: [embed]
|
||||||
|
|
|
@ -4,7 +4,8 @@ module.exports = {
|
||||||
/* ID of Bot's user */
|
/* ID of Bot's user */
|
||||||
user: "XXXXXXXXXXX",
|
user: "XXXXXXXXXXX",
|
||||||
/* For the support server */
|
/* For the support server */
|
||||||
production: true, // Set to true for production
|
/* Set to true for production */
|
||||||
|
production: true,
|
||||||
support: {
|
support: {
|
||||||
id: "XXXXXXXXXXX", // The ID of the support server
|
id: "XXXXXXXXXXX", // The ID of the support server
|
||||||
logs: "XXXXXXXXXXX", // And the ID of the logs channel of your server (new servers for example)
|
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",
|
"name": "jaba",
|
||||||
"version": "4.0pre1",
|
"version": "4.0pre3",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "jaba",
|
"name": "jaba",
|
||||||
"version": "4.0pre1",
|
"version": "4.0pre3",
|
||||||
"license": "ISC",
|
"license": "ISC",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@discord-player/extractor": "^3.0.2",
|
"@discord-player/extractor": "^3.0.2",
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "jaba",
|
"name": "jaba",
|
||||||
"version": "4.0pre1",
|
"version": "4.0pre3",
|
||||||
"description": "My Discord Bot",
|
"description": "My Discord Bot",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
|
Loading…
Reference in a new issue