mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
Скобочки =)
This commit is contained in:
parent
2132cb3879
commit
c232c7b205
14 changed files with 32 additions and 32 deletions
|
@ -98,7 +98,7 @@ class JaBa extends Client {
|
||||||
useUnifiedTopology: true,
|
useUnifiedTopology: true,
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
this.logger.log("Connected to the Mongodb database.", "log");
|
this.logger.log("Connected to the Mongodb database.", "log");
|
||||||
}).catch((err) => {
|
}).catch(err => {
|
||||||
this.logger.log(`Unable to connect to the Mongodb database. Error: ${err}`, "error");
|
this.logger.log(`Unable to connect to the Mongodb database. Error: ${err}`, "error");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -133,7 +133,7 @@ class JaBa extends Client {
|
||||||
this.commands.set(command.command.name, command);
|
this.commands.set(command.command.name, command);
|
||||||
const aliases = [];
|
const aliases = [];
|
||||||
if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0)
|
if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0)
|
||||||
command.aliases.forEach((alias) => {
|
command.aliases.forEach(alias => {
|
||||||
const command_alias = (command.command instanceof SlashCommandBuilder || command.command instanceof ContextMenuCommandBuilder) ? { ...command.command.toJSON() } : { ...command.command };
|
const command_alias = (command.command instanceof SlashCommandBuilder || command.command instanceof ContextMenuCommandBuilder) ? { ...command.command.toJSON() } : { ...command.command };
|
||||||
command_alias.name = alias;
|
command_alias.name = alias;
|
||||||
aliases.push(command_alias);
|
aliases.push(command_alias);
|
||||||
|
@ -181,7 +181,7 @@ class JaBa extends Client {
|
||||||
this.commands.set(command.command.name, command);
|
this.commands.set(command.command.name, command);
|
||||||
const aliases = [];
|
const aliases = [];
|
||||||
if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0)
|
if (command.aliases && Array.isArray(command.aliases) && command.aliases.length > 0)
|
||||||
command.aliases.forEach((alias) => {
|
command.aliases.forEach(alias => {
|
||||||
const command_alias = command.command instanceof SlashCommandBuilder ? { ...command.command.toJSON() } : { ...command.command };
|
const command_alias = command.command instanceof SlashCommandBuilder ? { ...command.command.toJSON() } : { ...command.command };
|
||||||
command_alias.name = alias;
|
command_alias.name = alias;
|
||||||
aliases.push(command_alias);
|
aliases.push(command_alias);
|
||||||
|
|
|
@ -32,8 +32,8 @@ class Staff extends BaseCommand {
|
||||||
*/
|
*/
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.guild.members.fetch();
|
await interaction.guild.members.fetch();
|
||||||
const administrators = interaction.guild.members.cache.filter((m) => m.permissions.has(PermissionsBitField.Flags.Administrator) && !m.user.bot);
|
const administrators = interaction.guild.members.cache.filter(m => m.permissions.has(PermissionsBitField.Flags.Administrator) && !m.user.bot);
|
||||||
const moderators = interaction.guild.members.cache.filter((m) => !administrators.has(m.id) && m.permissions.has(PermissionsBitField.Flags.ManageMessages) && !m.user.bot);
|
const moderators = interaction.guild.members.cache.filter(m => !administrators.has(m.id) && m.permissions.has(PermissionsBitField.Flags.ManageMessages) && !m.user.bot);
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
.setAuthor({
|
.setAuthor({
|
||||||
name: interaction.translate("general/staff:TITLE", {
|
name: interaction.translate("general/staff:TITLE", {
|
||||||
|
@ -43,11 +43,11 @@ class Staff extends BaseCommand {
|
||||||
.addFields([
|
.addFields([
|
||||||
{
|
{
|
||||||
name: interaction.translate("general/staff:ADMINS"),
|
name: interaction.translate("general/staff:ADMINS"),
|
||||||
value: (administrators.size > 0 ? administrators.map((a) => `${a.presence ? client.customEmojis.status[a.presence.status] : client.customEmojis.status.offline} | <@${a.user.id}>`).join("\n") : interaction.translate("general/staff:NO_ADMINS")),
|
value: (administrators.size > 0 ? administrators.map(a => `${a.presence ? client.customEmojis.status[a.presence.status] : client.customEmojis.status.offline} | <@${a.user.id}>`).join("\n") : interaction.translate("general/staff:NO_ADMINS")),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: interaction.translate("general/staff:MODS"),
|
name: interaction.translate("general/staff:MODS"),
|
||||||
value: (moderators.size > 0 ? moderators.map((m) => `${m.presence ? client.customEmojis.status[m.presence.status] : client.customEmojis.status.offline} | <@${m.user.id}>`).join("\n") : interaction.translate("general/staff:NO_MODS")),
|
value: (moderators.size > 0 ? moderators.map(m => `${m.presence ? client.customEmojis.status[m.presence.status] : client.customEmojis.status.offline} | <@${m.user.id}>`).join("\n") : interaction.translate("general/staff:NO_MODS")),
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
.setColor(client.config.embed.color)
|
.setColor(client.config.embed.color)
|
||||||
|
|
|
@ -80,9 +80,9 @@ class Userinfo extends BaseCommand {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: client.customEmojis.roles + " " + interaction.translate("common:ROLES"),
|
name: client.customEmojis.roles + " " + interaction.translate("common:ROLES"),
|
||||||
value: (member.roles.size > 10 ? member.roles.cache.map((r) => r).slice(0, 10).join(", ") + " " + interaction.translate("general/userinfo:MORE_ROLES", {
|
value: (member.roles.size > 10 ? member.roles.cache.map(r => r).slice(0, 10).join(", ") + " " + interaction.translate("general/userinfo:MORE_ROLES", {
|
||||||
count: member.roles.cache.size - 10,
|
count: member.roles.cache.size - 10,
|
||||||
}) : (member.roles.cache.size < 1) ? interaction.translate("general/userinfo:NO_ROLE") : member.roles.cache.map((r) => r).join(", ")),
|
}) : (member.roles.cache.size < 1) ? interaction.translate("general/userinfo:NO_ROLE") : member.roles.cache.map(r => r).join(", ")),
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
])
|
])
|
||||||
|
|
|
@ -34,7 +34,7 @@ class NSFW extends BaseCommand {
|
||||||
async execute(client, interaction) {
|
async execute(client, interaction) {
|
||||||
await interaction.deferReply({ ephemeral: true });
|
await interaction.deferReply({ ephemeral: true });
|
||||||
|
|
||||||
if ((interaction.guildId && !interaction.channel.nsfw)) return interaction.replyT("misc:NSFW_COMMAND", null, { ephemeral: true, edit: true });
|
if (interaction.guildId && !interaction.channel.nsfw) return interaction.replyT("misc:NSFW_COMMAND", null, { ephemeral: true, edit: true });
|
||||||
|
|
||||||
const tags = ["hentai", "ecchi", "lewdanimegirls", "hentaifemdom", "animefeets", "animebooty", "biganimetiddies", "sideoppai", "ahegao"].map(tag =>
|
const tags = ["hentai", "ecchi", "lewdanimegirls", "hentaifemdom", "animefeets", "animebooty", "biganimetiddies", "sideoppai", "ahegao"].map(tag =>
|
||||||
JSON.parse(JSON.stringify({
|
JSON.parse(JSON.stringify({
|
||||||
|
|
|
@ -7,7 +7,7 @@ const express = require("express"),
|
||||||
router.get("/:serverID", CheckAuth, async(req, res) => {
|
router.get("/:serverID", CheckAuth, async(req, res) => {
|
||||||
// Check if the user has the permissions to edit this guild
|
// Check if the user has the permissions to edit this guild
|
||||||
const guild = req.client.guilds.cache.get(req.params.serverID);
|
const guild = req.client.guilds.cache.get(req.params.serverID);
|
||||||
if (!guild || !req.userInfos.displayedGuilds || !req.userInfos.displayedGuilds.find((g) => g.id === req.params.serverID))
|
if (!guild || !req.userInfos.displayedGuilds || !req.userInfos.displayedGuilds.find(g => g.id === req.params.serverID))
|
||||||
return res.render("404", {
|
return res.render("404", {
|
||||||
user: req.userInfos,
|
user: req.userInfos,
|
||||||
translate: req.translate,
|
translate: req.translate,
|
||||||
|
@ -32,7 +32,7 @@ router.get("/:serverID", CheckAuth, async(req, res) => {
|
||||||
router.post("/:serverID", CheckAuth, async(req, res) => {
|
router.post("/:serverID", CheckAuth, async(req, res) => {
|
||||||
// Check if the user has the permissions to edit this guild
|
// Check if the user has the permissions to edit this guild
|
||||||
const guild = req.client.guilds.cache.get(req.params.serverID);
|
const guild = req.client.guilds.cache.get(req.params.serverID);
|
||||||
if (!guild || !req.userInfos.displayedGuilds || !req.userInfos.displayedGuilds.find((g) => g.id === req.params.serverID))
|
if (!guild || !req.userInfos.displayedGuilds || !req.userInfos.displayedGuilds.find(g => g.id === req.params.serverID))
|
||||||
return res.render("404", {
|
return res.render("404", {
|
||||||
user: req.userInfos,
|
user: req.userInfos,
|
||||||
translate: req.translate,
|
translate: req.translate,
|
||||||
|
@ -43,7 +43,7 @@ router.post("/:serverID", CheckAuth, async(req, res) => {
|
||||||
const data = req.body;
|
const data = req.body;
|
||||||
|
|
||||||
if (data.language) {
|
if (data.language) {
|
||||||
const language = req.client.languages.find((language) => language.nativeName.toLowerCase() === data.language.toLowerCase());
|
const language = req.client.languages.find(language => language.nativeName.toLowerCase() === data.language.toLowerCase());
|
||||||
if (language) guildData.language = language.name;
|
if (language) guildData.language = language.name;
|
||||||
if (data.prefix.length >= 1 && data.prefix.length < 2000) guildData.prefix = data.prefix;
|
if (data.prefix.length >= 1 && data.prefix.length < 2000) guildData.prefix = data.prefix;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ router.get("/:serverID", CheckAuth, async (req, res) => {
|
||||||
const membersData = await req.client.membersData.find({
|
const membersData = await req.client.membersData.find({
|
||||||
guildID: guild.id,
|
guildID: guild.id,
|
||||||
}).lean(),
|
}).lean(),
|
||||||
members = membersData.map((m) => {
|
members = membersData.map(m => {
|
||||||
return {
|
return {
|
||||||
id: m.id,
|
id: m.id,
|
||||||
money: m.money + m.bankSold,
|
money: m.money + m.bankSold,
|
||||||
|
|
|
@ -9,7 +9,7 @@ const { PermissionsBitField } = require("discord.js");
|
||||||
*/
|
*/
|
||||||
async function fetchUser(userData, client, query) {
|
async function fetchUser(userData, client, query) {
|
||||||
if (userData.guilds) {
|
if (userData.guilds) {
|
||||||
userData.guilds.forEach((guild) => {
|
userData.guilds.forEach(guild => {
|
||||||
if (!client.guilds.cache.get(guild.id)) return;
|
if (!client.guilds.cache.get(guild.id)) return;
|
||||||
const perms = new PermissionsBitField(BigInt(guild.permissions));
|
const perms = new PermissionsBitField(BigInt(guild.permissions));
|
||||||
if (perms.has(PermissionsBitField.Flags.ManageGuild)) guild.admin = true;
|
if (perms.has(PermissionsBitField.Flags.ManageGuild)) guild.admin = true;
|
||||||
|
@ -44,9 +44,9 @@ async function fetchUser(userData, client, query) {
|
||||||
* @returns {object} The user informations
|
* @returns {object} The user informations
|
||||||
*/
|
*/
|
||||||
async function fetchUsers(array, client) {
|
async function fetchUsers(array, client) {
|
||||||
return new Promise((resolve) => {
|
return new Promise(resolve => {
|
||||||
const users = [];
|
const users = [];
|
||||||
array.filter((e) => e.id).forEach((element) => {
|
array.filter(e => e.id).forEach(element => {
|
||||||
client.users.fetch(element.id).then(user => {
|
client.users.fetch(element.id).then(user => {
|
||||||
if (user.username.length > 15) user.username = user.username.substr(0, 12) + "...";
|
if (user.username.length > 15) user.username = user.username.substr(0, 12) + "...";
|
||||||
|
|
||||||
|
@ -80,7 +80,7 @@ async function fetchGuild(guildID, client, guilds) {
|
||||||
return {
|
return {
|
||||||
...guild,
|
...guild,
|
||||||
...conf.toJSON(),
|
...conf.toJSON(),
|
||||||
...guilds.find((g) => g.id === guild.id),
|
...guilds.find(g => g.id === guild.id),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
</a>
|
</a>
|
||||||
<% if (user.displayedGuilds) { %>
|
<% if (user.displayedGuilds) { %>
|
||||||
<ul class="treeview-menu">
|
<ul class="treeview-menu">
|
||||||
<% user.displayedGuilds.forEach((guild) => { %>
|
<% user.displayedGuilds.forEach(guild => { %>
|
||||||
<li><a href="<%= guild.settingsUrl %>"><i
|
<li><a href="<%= guild.settingsUrl %>"><i
|
||||||
class="fa fa-circle-o text-<%= guild.owner ? "green" : "grey" %>"></i>
|
class="fa fa-circle-o text-<%= guild.owner ? "green" : "grey" %>"></i>
|
||||||
<%= guild.name %></a></li>
|
<%= guild.name %></a></li>
|
||||||
|
|
|
@ -371,13 +371,13 @@
|
||||||
<% if (guild.plugins.autorole.enabled && guild.roles.cache.has(guild.plugins.autorole.role)) { %>
|
<% if (guild.plugins.autorole.enabled && guild.roles.cache.has(guild.plugins.autorole.role)) { %>
|
||||||
<option selected="selected">
|
<option selected="selected">
|
||||||
@<%= guild.roles.cache.get(guild.plugins.autorole.role).name %></option>
|
@<%= guild.roles.cache.get(guild.plugins.autorole.role).name %></option>
|
||||||
<% guild.roles.cache.filter((r) => r.id !== guild.plugins.autorole.role && r.name !== "@everyone").forEach((r) => { %>
|
<% guild.roles.cache.filter(r => r.id !== guild.plugins.autorole.role && r.name !== "@everyone").forEach(r => { %>
|
||||||
<option>@<%= r.name %></option>
|
<option>@<%= r.name %></option>
|
||||||
<% }); } else { %>
|
<% }); } else { %>
|
||||||
<option selected="selected">
|
<option selected="selected">
|
||||||
@<%= guild.roles.cache.filter((r) => r.name !== "@everyone").first().name %>
|
@<%= guild.roles.cache.filter(r => r.name !== "@everyone").first().name %>
|
||||||
</option>
|
</option>
|
||||||
<% guild.roles.cache.filter((r) => r.id !== guild.roles.cache.filter((r) => r.name !== "@everyone").first().id && r.name !== "@everyone").forEach((r) => { %>
|
<% guild.roles.cache.filter(r => r.id !== guild.roles.cache.filter(r => r.name !== "@everyone").first().id && r.name !== "@everyone").forEach(r => { %>
|
||||||
<option>@<%= r.name %></option>
|
<option>@<%= r.name %></option>
|
||||||
<% }); %>
|
<% }); %>
|
||||||
<% } %>
|
<% } %>
|
||||||
|
|
|
@ -132,7 +132,7 @@
|
||||||
|
|
||||||
/* LEADERBOARD */
|
/* LEADERBOARD */
|
||||||
let values = ["money", "level"];
|
let values = ["money", "level"];
|
||||||
values.forEach((value) => {
|
values.forEach(value => {
|
||||||
let members = JSON.parse(`<%- JSON.stringify(stats) %>`)[value].sort((a, b) => a - b);
|
let members = JSON.parse(`<%- JSON.stringify(stats) %>`)[value].sort((a, b) => a - b);
|
||||||
let data = {
|
let data = {
|
||||||
labels: members.map(a => a.username),
|
labels: members.map(a => a.username),
|
||||||
|
|
|
@ -42,7 +42,7 @@ class GuildMemberAdd extends BaseEvent {
|
||||||
guildId: member.guild.id,
|
guildId: member.guild.id,
|
||||||
});
|
});
|
||||||
if (memberData.mute.muted && memberData.mute.endDate > Date.now())
|
if (memberData.mute.muted && memberData.mute.endDate > Date.now())
|
||||||
member.guild.channels.cache.forEach((channel) => {
|
member.guild.channels.cache.forEach(channel => {
|
||||||
channel.permissionOverwrites.edit(member.id, {
|
channel.permissionOverwrites.edit(member.id, {
|
||||||
SEND_MESSAGES: false,
|
SEND_MESSAGES: false,
|
||||||
ADD_REACTIONS: false,
|
ADD_REACTIONS: false,
|
||||||
|
|
|
@ -17,8 +17,8 @@ module.exports.update = function (client) {
|
||||||
let text = `# JaBa имеет **${commands.length} ${client.getNoun(commands.length, "команда", "команды", "команд")}** в **${categories.length} ${client.getNoun(categories.length, "категории", "категориях", "категориях")}**! \n\n#### Содержимое таблицы \n**Название**: Название команды \n**Описание**: Описание команды \n**Использование**: Использование команды ( [] - обязательно, () - необязательно ) \n**Разрешено использование**: Где можно использовать команду \n\n`;
|
let text = `# JaBa имеет **${commands.length} ${client.getNoun(commands.length, "команда", "команды", "команд")}** в **${categories.length} ${client.getNoun(categories.length, "категории", "категориях", "категориях")}**! \n\n#### Содержимое таблицы \n**Название**: Название команды \n**Описание**: Описание команды \n**Использование**: Использование команды ( [] - обязательно, () - необязательно ) \n**Разрешено использование**: Где можно использовать команду \n\n`;
|
||||||
|
|
||||||
// categories.sort(function(a, b) {
|
// categories.sort(function(a, b) {
|
||||||
// const aCmdsSize = commands.filter((cmd) => cmd.category === a).size;
|
// const aCmdsSize = commands.filter(cmd => cmd.category === a).size;
|
||||||
// const bCmdsSize = commands.filter((cmd) => cmd.category === b).size;
|
// const bCmdsSize = commands.filter(cmd => cmd.category === b).size;
|
||||||
// if (aCmdsSize > bCmdsSize) return -1;
|
// if (aCmdsSize > bCmdsSize) return -1;
|
||||||
// else return 1;
|
// else return 1;
|
||||||
// })
|
// })
|
||||||
|
|
|
@ -22,7 +22,7 @@ module.exports.init = function (client) {
|
||||||
|
|
||||||
if (dUser) {
|
if (dUser) {
|
||||||
const reminds = user.reminds;
|
const reminds = user.reminds;
|
||||||
const mustSent = reminds.filter((r) => r.sendAt < dateNow);
|
const mustSent = reminds.filter(r => r.sendAt < dateNow);
|
||||||
|
|
||||||
if (mustSent.length > 0) {
|
if (mustSent.length > 0) {
|
||||||
mustSent.forEach(r => {
|
mustSent.forEach(r => {
|
||||||
|
|
|
@ -10,7 +10,7 @@ const { GatewayIntentBits } = require("discord.js"),
|
||||||
const checks = [
|
const checks = [
|
||||||
() => {
|
() => {
|
||||||
console.log("\n\nEnvironnement");
|
console.log("\n\nEnvironnement");
|
||||||
return new Promise((res) => {
|
return new Promise(res => {
|
||||||
if (parseInt(process.version.split(".")[0].split("v")[1]) >= 12) {
|
if (parseInt(process.version.split(".")[0].split("v")[1]) >= 12) {
|
||||||
success("node.js version equal or higher than v12");
|
success("node.js version equal or higher than v12");
|
||||||
} else {
|
} else {
|
||||||
|
@ -21,11 +21,11 @@ const checks = [
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
console.log("\n\nDiscord Bot");
|
console.log("\n\nDiscord Bot");
|
||||||
return new Promise((res) => {
|
return new Promise(res => {
|
||||||
const Discord = require("discord.js");
|
const Discord = require("discord.js");
|
||||||
const client = new Discord.Client({ intents: [ GatewayIntentBits.Guilds ] });
|
const client = new Discord.Client({ intents: [ GatewayIntentBits.Guilds ] });
|
||||||
let readyResolve;
|
let readyResolve;
|
||||||
new Promise((resolve) => readyResolve = resolve);
|
new Promise(resolve => readyResolve = resolve);
|
||||||
client.login(config.token).then(async () => {
|
client.login(config.token).then(async () => {
|
||||||
success("Valid bot token");
|
success("Valid bot token");
|
||||||
await readyResolve();
|
await readyResolve();
|
||||||
|
@ -44,7 +44,7 @@ const checks = [
|
||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
console.log("\n\nMongoDB");
|
console.log("\n\nMongoDB");
|
||||||
return new Promise((res) => {
|
return new Promise(res => {
|
||||||
const MongoClient = require("mongodb").MongoClient;
|
const MongoClient = require("mongodb").MongoClient;
|
||||||
const dbName = config.mongoDB.split("/").pop();
|
const dbName = config.mongoDB.split("/").pop();
|
||||||
const baseURL = config.mongoDB.substr(0, config.mongoDB.length - dbName.length);
|
const baseURL = config.mongoDB.substr(0, config.mongoDB.length - dbName.length);
|
||||||
|
@ -89,7 +89,7 @@ const checks = [
|
||||||
ignore("Dashboard is not enabled, skipping check.");
|
ignore("Dashboard is not enabled, skipping check.");
|
||||||
} else {
|
} else {
|
||||||
const checkPortTaken = (port) => {
|
const checkPortTaken = (port) => {
|
||||||
return new Promise((resolve) => {
|
return new Promise(resolve => {
|
||||||
const net = require("net");
|
const net = require("net");
|
||||||
const tester = net.createServer()
|
const tester = net.createServer()
|
||||||
.once("error", () => {
|
.once("error", () => {
|
||||||
|
|
Loading…
Reference in a new issue