mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-24 06:04:57 +05:00
yay
This commit is contained in:
parent
19a58a9748
commit
92f64e4d94
10 changed files with 52 additions and 131 deletions
|
@ -277,7 +277,7 @@ class JaBa extends Client {
|
||||||
memberData = new this.membersData({ id: memberID, guildID: guildId });
|
memberData = new this.membersData({ id: memberID, guildID: guildId });
|
||||||
await memberData.save();
|
await memberData.save();
|
||||||
|
|
||||||
const guildData = await this.findOrCreateGuild({ id: guildId });
|
const guildData = await this.findOrCreateGuild(guildId);
|
||||||
|
|
||||||
if (guildData) {
|
if (guildData) {
|
||||||
guildData.members.push(memberData._id);
|
guildData.members.push(memberData._id);
|
||||||
|
@ -297,7 +297,7 @@ class JaBa extends Client {
|
||||||
* @param {Array} param0 { id: Guild ID }
|
* @param {Array} param0 { id: Guild ID }
|
||||||
* @returns {import("./Guild")} Mongoose model or JSON of this guild
|
* @returns {import("./Guild")} Mongoose model or JSON of this guild
|
||||||
*/
|
*/
|
||||||
async findOrCreateGuild({ id: guildId }) {
|
async findOrCreateGuild(guildId) {
|
||||||
let guildData = await this.guildsData.findOne({ id: guildId }).populate("members");
|
let guildData = await this.guildsData.findOne({ id: guildId }).populate("members");
|
||||||
|
|
||||||
if (guildData) {
|
if (guildData) {
|
||||||
|
|
|
@ -31,7 +31,7 @@ class CreateTicketEmbed extends BaseCommand {
|
||||||
client.on("interactionCreate", async interaction => {
|
client.on("interactionCreate", async interaction => {
|
||||||
if (!interaction.isButton()) return;
|
if (!interaction.isButton()) return;
|
||||||
|
|
||||||
const guildData = await client.findOrCreateGuild({ id: interaction.guildId });
|
const guildData = await client.findOrCreateGuild(interaction.guildId);
|
||||||
|
|
||||||
const ticketsCategory = guildData.plugins.tickets.ticketsCategory,
|
const ticketsCategory = guildData.plugins.tickets.ticketsCategory,
|
||||||
ticketLogs = guildData.plugins.tickets.ticketLogs,
|
ticketLogs = guildData.plugins.tickets.ticketLogs,
|
||||||
|
|
|
@ -20,16 +20,12 @@ module.exports = client => [
|
||||||
Ukrainian: "uk-UA",
|
Ukrainian: "uk-UA",
|
||||||
}),
|
}),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.language;
|
return guildData.language;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
guildData.language = newData;
|
guildData.language = newData;
|
||||||
|
|
||||||
|
@ -50,16 +46,12 @@ module.exports = client => [
|
||||||
optionDescription: "Toggle welcome messages sending",
|
optionDescription: "Toggle welcome messages sending",
|
||||||
optionType: DBD.formTypes.switch(),
|
optionType: DBD.formTypes.switch(),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins.welcome.enabled;
|
return guildData.plugins.welcome.enabled;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
guildData.plugins.welcome.enabled = newData;
|
guildData.plugins.welcome.enabled = newData;
|
||||||
|
|
||||||
|
@ -75,16 +67,12 @@ module.exports = client => [
|
||||||
optionDescription: "Toggle sending an image with welcome message",
|
optionDescription: "Toggle sending an image with welcome message",
|
||||||
optionType: DBD.formTypes.switch(),
|
optionType: DBD.formTypes.switch(),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins.welcome.withImage;
|
return guildData.plugins.welcome.withImage;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
guildData.plugins.welcome.withImage = newData;
|
guildData.plugins.welcome.withImage = newData;
|
||||||
|
|
||||||
|
@ -100,16 +88,12 @@ module.exports = client => [
|
||||||
optionDescription: "Change welcome message (You can use {user}, {server} and {membercount} wildcards)",
|
optionDescription: "Change welcome message (You can use {user}, {server} and {membercount} wildcards)",
|
||||||
optionType: DBD.formTypes.input("Welcome, {user}!", 2, 100, false, false),
|
optionType: DBD.formTypes.input("Welcome, {user}!", 2, 100, false, false),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins.welcome.message;
|
return guildData.plugins.welcome.message;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
guildData.plugins.welcome.message = newData !== "" ? newData : null;
|
guildData.plugins.welcome.message = newData !== "" ? newData : null;
|
||||||
|
|
||||||
|
@ -125,16 +109,12 @@ module.exports = client => [
|
||||||
optionDescription: "Select a channel for welcome messages",
|
optionDescription: "Select a channel for welcome messages",
|
||||||
optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]),
|
optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins.welcome.channel;
|
return guildData.plugins.welcome.channel;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
guildData.plugins.welcome.channel = newData !== "" ? newData : null;
|
guildData.plugins.welcome.channel = newData !== "" ? newData : null;
|
||||||
|
|
||||||
|
@ -157,16 +137,12 @@ module.exports = client => [
|
||||||
optionDescription: "Toggle goodbye messages sending",
|
optionDescription: "Toggle goodbye messages sending",
|
||||||
optionType: DBD.formTypes.switch(),
|
optionType: DBD.formTypes.switch(),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins.goodbye.enabled;
|
return guildData.plugins.goodbye.enabled;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
guildData.plugins.goodbye.enabled = newData;
|
guildData.plugins.goodbye.enabled = newData;
|
||||||
|
|
||||||
|
@ -182,16 +158,12 @@ module.exports = client => [
|
||||||
optionDescription: "Toggle sending an image with goodbye message",
|
optionDescription: "Toggle sending an image with goodbye message",
|
||||||
optionType: DBD.formTypes.switch(),
|
optionType: DBD.formTypes.switch(),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins.goodbye.withImage;
|
return guildData.plugins.goodbye.withImage;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
guildData.plugins.goodbye.withImage = newData;
|
guildData.plugins.goodbye.withImage = newData;
|
||||||
|
|
||||||
|
@ -207,16 +179,12 @@ module.exports = client => [
|
||||||
optionDescription: "Change goodbye message (You can use {user}, {server} and {membercount} wildcards)",
|
optionDescription: "Change goodbye message (You can use {user}, {server} and {membercount} wildcards)",
|
||||||
optionType: DBD.formTypes.input("goodbye, {user}!", 2, 100, false, false),
|
optionType: DBD.formTypes.input("goodbye, {user}!", 2, 100, false, false),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins.goodbye.message;
|
return guildData.plugins.goodbye.message;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
guildData.plugins.goodbye.message = newData !== "" ? newData : null;
|
guildData.plugins.goodbye.message = newData !== "" ? newData : null;
|
||||||
|
|
||||||
|
@ -232,16 +200,12 @@ module.exports = client => [
|
||||||
optionDescription: "Select a channel for goodbye messages",
|
optionDescription: "Select a channel for goodbye messages",
|
||||||
optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]),
|
optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins.goodbye.channel;
|
return guildData.plugins.goodbye.channel;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
guildData.plugins.goodbye.channel = newData !== "" ? newData : null;
|
guildData.plugins.goodbye.channel = newData !== "" ? newData : null;
|
||||||
|
|
||||||
|
@ -264,16 +228,12 @@ module.exports = client => [
|
||||||
optionDescription: "Toggle auto role granting for new members",
|
optionDescription: "Toggle auto role granting for new members",
|
||||||
optionType: DBD.formTypes.switch(),
|
optionType: DBD.formTypes.switch(),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins.autorole.enabled;
|
return guildData.plugins.autorole.enabled;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
guildData.plugins.autorole.enabled = newData;
|
guildData.plugins.autorole.enabled = newData;
|
||||||
|
|
||||||
|
@ -289,16 +249,12 @@ module.exports = client => [
|
||||||
optionDescription: "Select a role for auto role. Select \"-\" to disable",
|
optionDescription: "Select a role for auto role. Select \"-\" to disable",
|
||||||
optionType: DBD.formTypes.rolesSelect(false, false, true),
|
optionType: DBD.formTypes.rolesSelect(false, false, true),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins.autorole.role;
|
return guildData.plugins.autorole.role;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
guildData.plugins.autorole.role = newData !== "" ? newData : null;
|
guildData.plugins.autorole.role = newData !== "" ? newData : null;
|
||||||
|
|
||||||
|
@ -321,16 +277,12 @@ module.exports = client => [
|
||||||
optionDescription: "Toggle auto mod. It will remove invite links from non-moderators",
|
optionDescription: "Toggle auto mod. It will remove invite links from non-moderators",
|
||||||
optionType: DBD.formTypes.switch(),
|
optionType: DBD.formTypes.switch(),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins.automod.enabled;
|
return guildData.plugins.automod.enabled;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
guildData.plugins.automod.enabled = newData;
|
guildData.plugins.automod.enabled = newData;
|
||||||
|
|
||||||
|
@ -346,16 +298,12 @@ module.exports = client => [
|
||||||
optionDescription: "Select a channels for auto mod to ignore",
|
optionDescription: "Select a channels for auto mod to ignore",
|
||||||
optionType: DBD.formTypes.channelsMultiSelect(false, false, [ChannelType.GuildText]),
|
optionType: DBD.formTypes.channelsMultiSelect(false, false, [ChannelType.GuildText]),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins.automod.ignored;
|
return guildData.plugins.automod.ignored;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
guildData.plugins.automod.ignored = newData;
|
guildData.plugins.automod.ignored = newData;
|
||||||
|
|
||||||
|
@ -378,16 +326,12 @@ module.exports = client => [
|
||||||
optionDescription: "Select a channel for messages update logs to go to. Select \"-\" to disable",
|
optionDescription: "Select a channel for messages update logs to go to. Select \"-\" to disable",
|
||||||
optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]),
|
optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins?.monitoring?.messageUpdate;
|
return guildData.plugins?.monitoring?.messageUpdate;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (guildData.plugins.monitoring === undefined) guildData.plugins.monitoring = {};
|
if (guildData.plugins.monitoring === undefined) guildData.plugins.monitoring = {};
|
||||||
|
|
||||||
|
@ -405,16 +349,12 @@ module.exports = client => [
|
||||||
optionDescription: "Select a channel for messages deletion logs to go to. Select \"-\" to disable",
|
optionDescription: "Select a channel for messages deletion logs to go to. Select \"-\" to disable",
|
||||||
optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]),
|
optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins?.monitoring?.messageDelete;
|
return guildData.plugins?.monitoring?.messageDelete;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (guildData.plugins.monitoring === undefined) guildData.plugins.monitoring = {};
|
if (guildData.plugins.monitoring === undefined) guildData.plugins.monitoring = {};
|
||||||
|
|
||||||
|
@ -439,16 +379,12 @@ module.exports = client => [
|
||||||
optionDescription: "Select a channel for suggestions to go to",
|
optionDescription: "Select a channel for suggestions to go to",
|
||||||
optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]),
|
optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins.suggestions;
|
return guildData.plugins.suggestions;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
guildData.plugins.suggestions = newData !== "" ? newData : null;
|
guildData.plugins.suggestions = newData !== "" ? newData : null;
|
||||||
|
|
||||||
|
@ -464,16 +400,12 @@ module.exports = client => [
|
||||||
optionDescription: "Select a channel for reports to go to. Select \"-\" to disable",
|
optionDescription: "Select a channel for reports to go to. Select \"-\" to disable",
|
||||||
optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]),
|
optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins.reports;
|
return guildData.plugins.reports;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
guildData.plugins.reports = newData !== "" ? newData : null;
|
guildData.plugins.reports = newData !== "" ? newData : null;
|
||||||
|
|
||||||
|
@ -489,16 +421,12 @@ module.exports = client => [
|
||||||
optionDescription: "Select a channel for birthdays message to go to. Select \"-\" to disable",
|
optionDescription: "Select a channel for birthdays message to go to. Select \"-\" to disable",
|
||||||
optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]),
|
optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins.birthdays;
|
return guildData.plugins.birthdays;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
guildData.plugins.birthdays = newData !== "" ? newData : null;
|
guildData.plugins.birthdays = newData !== "" ? newData : null;
|
||||||
|
|
||||||
|
@ -514,16 +442,12 @@ module.exports = client => [
|
||||||
optionDescription: "Select a channel for moderation logs to go to (warns). Select \"-\" to disable",
|
optionDescription: "Select a channel for moderation logs to go to (warns). Select \"-\" to disable",
|
||||||
optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]),
|
optionType: DBD.formTypes.channelsSelect(false, [ChannelType.GuildText]),
|
||||||
getActualSet: async ({ guild }) => {
|
getActualSet: async ({ guild }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.plugins.modlogs;
|
return guildData.plugins.modlogs;
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
setNew: async ({ guild, newData }) => {
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
guildData.plugins.modlogs = newData !== "" ? newData : null;
|
guildData.plugins.modlogs = newData !== "" ? newData : null;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ class CommandHandler extends BaseEvent {
|
||||||
data.userData = userData;
|
data.userData = userData;
|
||||||
|
|
||||||
if (interaction.inGuild()) {
|
if (interaction.inGuild()) {
|
||||||
const guildData = await client.findOrCreateGuild({ id: interaction.guildId });
|
const guildData = await client.findOrCreateGuild(interaction.guildId);
|
||||||
const memberData = await client.findOrCreateMember({ id: interaction.member.id, guildId: interaction.guildId });
|
const memberData = await client.findOrCreateMember({ id: interaction.member.id, guildId: interaction.guildId });
|
||||||
|
|
||||||
interaction.guild.data = data.guildData = guildData;
|
interaction.guild.data = data.guildData = guildData;
|
||||||
|
|
|
@ -32,9 +32,7 @@ class GuildMemberAdd extends BaseEvent {
|
||||||
|
|
||||||
await member.guild.members.fetch();
|
await member.guild.members.fetch();
|
||||||
|
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(member.guild.id);
|
||||||
id: member.guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (guildData.plugins.autorole.enabled) member.roles.add(guildData.plugins.autorole.role);
|
if (guildData.plugins.autorole.enabled) member.roles.add(guildData.plugins.autorole.role);
|
||||||
|
|
||||||
|
|
|
@ -32,9 +32,7 @@ class GuildMemberRemove extends BaseEvent {
|
||||||
|
|
||||||
await member.guild.members.fetch();
|
await member.guild.members.fetch();
|
||||||
|
|
||||||
const guildData = await client.findOrCreateGuild({
|
const guildData = await client.findOrCreateGuild(member.guild.id);
|
||||||
id: member.guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
if (guildData.plugins.goodbye.enabled) {
|
if (guildData.plugins.goodbye.enabled) {
|
||||||
const channel = member.guild.channels.cache.get(guildData.plugins.goodbye.channel);
|
const channel = member.guild.channels.cache.get(guildData.plugins.goodbye.channel);
|
||||||
|
|
|
@ -29,7 +29,7 @@ class MessageCreate extends BaseEvent {
|
||||||
|
|
||||||
if (message.guild && !message.member) await message.guild.members.fetch(message.author.id);
|
if (message.guild && !message.member) await message.guild.members.fetch(message.author.id);
|
||||||
if (message.guild) {
|
if (message.guild) {
|
||||||
const guildData = await client.findOrCreateGuild({ id: message.guildId });
|
const guildData = await client.findOrCreateGuild(message.guildId);
|
||||||
const memberData = await client.findOrCreateMember({ id: message.author.id, guildId: message.guildId });
|
const memberData = await client.findOrCreateMember({ id: message.author.id, guildId: message.guildId });
|
||||||
|
|
||||||
message.guild.data = data.guildData = guildData;
|
message.guild.data = data.guildData = guildData;
|
||||||
|
|
|
@ -18,7 +18,7 @@ class messageDelete extends BaseEvent {
|
||||||
if (message.guild && message.guildId === "568120814776614924") return;
|
if (message.guild && message.guildId === "568120814776614924") return;
|
||||||
if (message.author.bot) return;
|
if (message.author.bot) return;
|
||||||
|
|
||||||
const guildData = await client.findOrCreateGuild({ id: message.guildId });
|
const guildData = await client.findOrCreateGuild(message.guildId);
|
||||||
|
|
||||||
if (guildData.plugins?.monitoring?.messageDelete) {
|
if (guildData.plugins?.monitoring?.messageDelete) {
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
|
|
|
@ -21,7 +21,7 @@ class messageUpdate extends BaseEvent {
|
||||||
|
|
||||||
if (oldMessage.content === newMessage.content) return;
|
if (oldMessage.content === newMessage.content) return;
|
||||||
|
|
||||||
const guildData = await client.findOrCreateGuild({ id: oldMessage.guildId });
|
const guildData = await client.findOrCreateGuild(oldMessage.guildId);
|
||||||
|
|
||||||
if (guildData.plugins?.monitoring?.messageUpdate) {
|
if (guildData.plugins?.monitoring?.messageUpdate) {
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
|
|
|
@ -6,12 +6,12 @@ const { CronJob } = require("cron"),
|
||||||
* @param {import("../base/JaBa")} client
|
* @param {import("../base/JaBa")} client
|
||||||
*/
|
*/
|
||||||
module.exports.init = async function (client) {
|
module.exports.init = async function (client) {
|
||||||
new CronJob("0 5 * * *", async function () {
|
const cronjob = new CronJob("0 5 * * *", async function () {
|
||||||
client.guilds.cache.forEach(async guild => {
|
client.guilds.cache.forEach(async guild => {
|
||||||
const guildData = await client.findOrCreateGuild({ id: guild.id });
|
const guildData = await client.findOrCreateGuild(guild.id);
|
||||||
|
|
||||||
if (guildData.plugins.birthdays) {
|
if (guildData.plugins.birthdays) {
|
||||||
const channel = client.channels.cache.get(guildData.plugins.birthdays),
|
const channel = client.channels.cache.get(guildData.plugins.birthdays) || await client.channels.fetch(guildData.plugins.birthdays),
|
||||||
date = new Date(),
|
date = new Date(),
|
||||||
currentDay = date.getDate(),
|
currentDay = date.getDate(),
|
||||||
currentMonth = date.getMonth(),
|
currentMonth = date.getMonth(),
|
||||||
|
@ -60,6 +60,7 @@ module.exports.init = async function (client) {
|
||||||
},
|
},
|
||||||
null,
|
null,
|
||||||
true,
|
true,
|
||||||
"Europe/Moscow",
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
cronjob.start();
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue