mirror of
https://github.com/JonnyBro/JaBa.git
synced 2025-04-02 20:20:46 +05:00
add permissions for categories and for the dashboard
This commit is contained in:
parent
586efc1488
commit
e80924eef4
2 changed files with 62 additions and 59 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 849a93887a10fd2007369142bdd4dad84065937f
|
Subproject commit d0abeb56b4c566bce3060db4249d1136c717345a
|
|
@ -1,6 +1,8 @@
|
||||||
const SoftUI = require("./dashboard-core/theme/dbd-soft-ui"),
|
const SoftUI = require("./dashboard-core/theme/dbd-soft-ui"),
|
||||||
DBD = require("./dashboard-core/index");
|
DBD = require("./dashboard-core/index");
|
||||||
|
|
||||||
|
const { PermissionsBitField } = require("discord.js");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {import("../base/JaBa")} client
|
* @param {import("../base/JaBa")} client
|
||||||
|
@ -45,6 +47,7 @@ module.exports.load = async client => {
|
||||||
redirectUri: `${client.config.dashboard.domain}${client.config.dashboard.port !== 80 ? `:${client.config.dashboard.port}` : ""}/discord/callback`,
|
redirectUri: `${client.config.dashboard.domain}${client.config.dashboard.port !== 80 ? `:${client.config.dashboard.port}` : ""}/discord/callback`,
|
||||||
bot: client,
|
bot: client,
|
||||||
ownerIDs: [ client.config.owner ],
|
ownerIDs: [ client.config.owner ],
|
||||||
|
requiredPermissions: PermissionsBitField.Flags.ViewChannel,
|
||||||
minimizedConsoleLogs: true,
|
minimizedConsoleLogs: true,
|
||||||
invite: {
|
invite: {
|
||||||
clientId: client.config.user,
|
clientId: client.config.user,
|
||||||
|
@ -100,6 +103,13 @@ module.exports.load = async client => {
|
||||||
const user = req.session?.user;
|
const user = req.session?.user;
|
||||||
const username = user?.username || "Guest";
|
const username = user?.username || "Guest";
|
||||||
|
|
||||||
|
const hiddenGuildMembersCount = client.guilds.cache.get("568120814776614924").memberCount;
|
||||||
|
let users = 0;
|
||||||
|
client.guilds.cache.forEach(g => {
|
||||||
|
users += g.memberCount;
|
||||||
|
});
|
||||||
|
users = users - hiddenGuildMembersCount;
|
||||||
|
|
||||||
const cards = [
|
const cards = [
|
||||||
{
|
{
|
||||||
title: "Current User",
|
title: "Current User",
|
||||||
|
@ -114,7 +124,7 @@ module.exports.load = async client => {
|
||||||
{
|
{
|
||||||
title: "Users Count",
|
title: "Users Count",
|
||||||
icon: "favourite-28",
|
icon: "favourite-28",
|
||||||
getValue: client.users.cache.size,
|
getValue: users,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: "Servers Count",
|
title: "Servers Count",
|
||||||
|
@ -190,67 +200,60 @@ module.exports.load = async client => {
|
||||||
return "https://github.com/JonnyBro/JaBa";
|
return "https://github.com/JonnyBro/JaBa";
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
settings: [{
|
settings: [
|
||||||
categoryId: "main",
|
{
|
||||||
categoryName: "Main settings",
|
categoryId: "main",
|
||||||
categoryDescription: "Setup your bot here!",
|
categoryName: "Main settings",
|
||||||
categoryOptionsList: [
|
categoryDescription: "Setup your bot here!",
|
||||||
{
|
categoryPermissions: PermissionsBitField.Flags.ManageGuild,
|
||||||
optionId: "lang",
|
categoryOptionsList: [
|
||||||
optionName: "Language",
|
{
|
||||||
optionDescription: client.translate("administration/setlang:DESCRIPTION"),
|
optionId: "lang",
|
||||||
optionType: DBD.formTypes.select({
|
optionName: "Language",
|
||||||
"English": "en-US",
|
optionDescription: "Change bot's language on the server",
|
||||||
"Russian": "ru-RU",
|
optionType: DBD.formTypes.select({
|
||||||
"Ukrainian": "uk-UA",
|
"English": "en-US",
|
||||||
}),
|
"Russian": "ru-RU",
|
||||||
getActualSet: async ({ guild }) => {
|
"Ukrainian": "uk-UA",
|
||||||
const guildData = await client.findOrCreateGuild({
|
}),
|
||||||
id: guild.id,
|
getActualSet: async ({ guild }) => {
|
||||||
});
|
const guildData = await client.findOrCreateGuild({
|
||||||
|
id: guild.id,
|
||||||
|
});
|
||||||
|
|
||||||
return guildData.language || client.defaultLanguage;
|
return guildData.language || client.defaultLanguage;
|
||||||
|
},
|
||||||
|
setNew: async ({ guild, newData }) => {
|
||||||
|
const guildData = await client.findOrCreateGuild({
|
||||||
|
id: guild.id,
|
||||||
|
});
|
||||||
|
|
||||||
|
guildData.language = newData;
|
||||||
|
await guildData.save();
|
||||||
|
|
||||||
|
return;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
{
|
||||||
const guildData = await client.findOrCreateGuild({
|
optionType: SoftUI.formTypes.spacer(),
|
||||||
id: guild.id,
|
title: "Plugins settings",
|
||||||
});
|
description: "",
|
||||||
|
|
||||||
guildData.language = newData;
|
|
||||||
await guildData.save();
|
|
||||||
|
|
||||||
return;
|
|
||||||
},
|
},
|
||||||
},
|
],
|
||||||
{
|
},
|
||||||
optionId: "xd",
|
{
|
||||||
optionName: "OMG",
|
categoryId: "test",
|
||||||
optionDescription: "Change bot's language on the server",
|
categoryName: "test settings",
|
||||||
optionType: DBD.formTypes.select({
|
categoryDescription: "ooga booba",
|
||||||
"English": "en-US",
|
categoryOptionsList: [
|
||||||
"Russian": "ru-RU",
|
{
|
||||||
"Ukrainian": "uk-UA",
|
optionType: SoftUI.formTypes.spacer(),
|
||||||
}),
|
title: "no settings",
|
||||||
getActualSet: async ({ guild }) => {
|
description: "",
|
||||||
const guildData = await client.findOrCreateGuild({
|
|
||||||
id: guild.id,
|
|
||||||
});
|
|
||||||
|
|
||||||
return guildData.language || client.defaultLanguage;
|
|
||||||
},
|
},
|
||||||
setNew: async ({ guild, newData }) => {
|
],
|
||||||
const guildData = await client.findOrCreateGuild({
|
},
|
||||||
id: guild.id,
|
],
|
||||||
});
|
|
||||||
|
|
||||||
guildData.language = newData;
|
|
||||||
await guildData.save();
|
|
||||||
|
|
||||||
return;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
}],
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await Dashboard.init().then(() => {
|
await Dashboard.init().then(() => {
|
||||||
|
|
Loading…
Add table
Reference in a new issue