some updates, will update to my own fork of dashboard soon

This commit is contained in:
Jonny_Bro (Nikita) 2023-06-22 17:33:33 +05:00
parent 274672a405
commit b0078f3a26
5 changed files with 359 additions and 319 deletions

View file

@ -70,8 +70,8 @@ class Play extends BaseCommand {
leaveOnEnd: false, leaveOnEnd: false,
leaveOnStop: true, leaveOnStop: true,
skipOnNoStream: true, skipOnNoStream: true,
maxSize: 500, maxSize: 200,
maxHistorySize: 100, maxHistorySize: 50,
}); });
} }

View file

@ -1,6 +1,5 @@
const SoftUI = require("dbd-soft-ui"), const SoftUI = require("dbd-soft-ui"),
DBD = require("discord-dashboard"), DBD = require("discord-dashboard");
os = require("os");
/** /**
* *
@ -44,18 +43,17 @@ module.exports.load = async client => {
id: client.config.user, id: client.config.user,
secret: client.config.dashboard.secret, secret: client.config.dashboard.secret,
}, },
cookiesSecret: client.config.dashboard.secret,
domain: client.config.dashboard.domain, domain: client.config.dashboard.domain,
redirectUri: `${client.config.dashboard.domain}/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: [ DBD.DISCORD_FLAGS.Permissions.VIEW_CHANNEL ],
acceptPrivacyPolicy: true,
minimizedConsoleLogs: true, minimizedConsoleLogs: true,
invite: { invite: {
clientId: client.config.user, clientId: client.config.user,
scopes: ["bot", "applications.commands"], scopes: ["bot", "applications.commands"],
permissions: "8", permissions: "8",
redirectUri: client.config.dashboard.domain, redirectUri: client.config.dashboard.domain + client.config.dashboard.port !== 80 ? `:${client.config.dashboard.port}` : "",
}, },
supportServer: { supportServer: {
slash: "/support", slash: "/support",
@ -102,43 +100,32 @@ module.exports.load = async client => {
customThemeOptions: { customThemeOptions: {
// eslint-disable-next-line no-unused-vars // eslint-disable-next-line no-unused-vars
index: async ({ req, res, config }) => { index: async ({ req, res, config }) => {
const username = req.session?.user?.username || "Guest"; const user = req.session?.user;
const username = user?.username || "Guest";
const cards = [ const cards = [
{ {
title: "Current User", title: "Current User",
icon: "single-02", icon: "single-02",
getValue: username, getValue: username,
progressBar: {
enabled: false,
getProgress: client.guilds.cache.size,
},
}, },
{ {
title: "CPU", title: "Node Version",
icon: "tv-2",
getValue: os.cpus()[0].model,
progressBar: {
enabled: false,
getProgress: 50,
},
},
{
title: "System Platform",
icon: "settings-gear-65", icon: "settings-gear-65",
getValue: os.platform(), getValue: process.versions.node,
progressBar: {
enabled: false,
getProgress: 50,
},
}, },
{ {
title: "Server Count", title: "Users Count",
icon: "favourite-28",
getValue: client.users.cache.size,
},
{
title: "Servers Count",
icon: "notification-70", icon: "notification-70",
getValue: `${client.guilds.cache.size} out of 2000`, getValue: `${client.guilds.cache.size} out of 2000`,
progressBar: { progressBar: {
enabled: true, enabled: true,
getProgress: (client.guilds.cache.size / 2000) * 100, getProgress: Math.round((client.guilds.cache.size / 2000) * 100),
}, },
}, },
]; ];
@ -196,50 +183,82 @@ module.exports.load = async client => {
}, },
commands: categories, commands: categories,
locales: { locales: {
enUS: require("../languages/en-US/dashboard.json"), enUS: require("../languages/en-US/dashboard.json").DASHBOARD,
ruRU: require("../languages/ru-RU/dashboard.json"), ruRU: require("../languages/ru-RU/dashboard.json").DASHBOARD,
ukUA: require("../languages/uk-UA/dashboard.json"), ukUA: require("../languages/uk-UA/dashboard.json").DASHBOARD,
}, },
}), }),
customPages: [
DBD.customPagesTypes.redirectToUrl("/github", () => {
return "https://github.com/JonnyBro/JaBa";
}),
],
settings: [{ settings: [{
categoryId: "setup", categoryId: "main",
categoryName: "Setup", categoryName: "Main settings",
categoryDescription: "Setup your bot with default settings!", categoryDescription: "Setup your bot here!",
categoryOptionsList: [{ categoryOptionsList: [
optionId: "lang", {
optionName: "Language", optionId: "lang",
optionDescription: "Change bot's language easily", optionName: "Language",
optionType: DBD.formTypes.select({ optionDescription: client.translate("administration/setlang:DESCRIPTION"),
"English": "en-US", optionType: DBD.formTypes.select({
"Russian": "ru-RU", "English": "en-US",
"Ukrainian": "uk-UA", "Russian": "ru-RU",
}), "Ukrainian": "uk-UA",
getActualSet: async ({ guild }) => { }),
const guildData = await client.findOrCreateGuild({ getActualSet: async ({ guild }) => {
id: guild.id, 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({ optionId: "xd",
id: guild.id, optionName: "OMG",
}); optionDescription: "Change bot's language on the server",
optionType: DBD.formTypes.select({
"English": "en-US",
"Russian": "ru-RU",
"Ukrainian": "uk-UA",
}),
getActualSet: async ({ guild }) => {
const guildData = await client.findOrCreateGuild({
id: guild.id,
});
guildData.language = newData; return guildData.language || client.defaultLanguage;
await guildData.save(); },
setNew: async ({ guild, newData }) => {
const guildData = await client.findOrCreateGuild({
id: guild.id,
});
return; guildData.language = newData;
await guildData.save();
return;
},
}, },
}], ],
}], }],
}); });
DBD.customPagesTypes.redirectToUrl("github", "https://github.com/JonnyBro/JaBa");
await Dashboard.init().then(() => { await Dashboard.init().then(() => {
client.logger.log(`Dashboard launched on port ${client.config.dashboard.port}`, "ready"); client.logger.log(`Dashboard launched on port ${client.config.dashboard.port}`, "ready");
}).catch(err => { }).catch(err => {
client.logger.log(`Dashboard failed to initialize: ${err}`, "error"); client.logger.log(`Dashboard failed to initialize:\n${err}`, "error");
}); });
}; };

View file

@ -1,91 +1,98 @@
{ {
"name": "English", "DASHBOARD": {
"index": { "name": "English",
"feeds": [ "Current User", "CPU", "System Platform", "Server Count" ], "index": {
"card": { "feeds": [ "Current User", "Node version", "Users Count", "Servers Count" ],
"category": "JaBa Bot", "card": {
"title": "Simple bot made by <a href=\"https://github.com/JonnyBro\">Jonny_Bro</a>", "category": "JaBa Bot",
"description": "Upper Text", "title": "Simple bot made by <a href=\"https://github.com/JonnyBro\">Jonny_Bro</a>",
"image": "", "description": "Upper Text",
"footer": "Bottom Text" "image": "",
}, "footer": "Bottom Text"
"feedsTitle": "Feeds",
"graphTitle": "Graphs"
},
"manage": {
"settings": {
"memberCount": "Members",
"info": {
"info": "Info",
"server": "Server Information"
}
}
},
"privacyPolicy": {
"title": "Privacy Policy",
"description": "Privacy Policy and Terms of Service",
"pp": "Complete Privacy Policy"
},
"partials": {
"sidebar": {
"dash": "Dashboard",
"manage": "Manage Guilds",
"commands": "Commands",
"pp": "Privacy Policy",
"admin": "Admin",
"account": "Account Pages",
"login": "Sign In",
"logout": "Sign Out"
},
"navbar": {
"home": "Home",
"pages": {
"manage": "Manage Guilds",
"settings": "Manage Guilds",
"commands": "Commands",
"pp": "Privacy Policy",
"admin": "Admin Panel",
"error": "Error",
"credits": "Credits",
"debug": "Debug",
"leaderboard": "Leaderboard",
"profile": "Profile",
"maintenance": "Under Maintenance"
}
},
"title": {
"pages": {
"manage": "Manage Guilds",
"settings": "Manage Guilds",
"commands": "Commands",
"pp": "Privacy Policy",
"admin": "Admin Panel",
"error": "Error",
"credits": "Credits",
"debug": "Debug",
"leaderboard": "Leaderboard",
"profile": "Profile",
"maintenance": "Under Maintenance"
}
},
"preloader": {
"text": "Page is loading..."
},
"premium": {
"title": "Want more from JaBa?",
"description": "Check out premium features below!",
"buttonText": "Become Premium"
},
"settings": {
"title": "Site Configuration",
"description": "Configurable Viewing Options",
"theme": {
"title": "Site Theme",
"description": "Make the site more appealing for your eyes!"
}, },
"language": { "feedsTitle": "Feeds",
"title": "Site Language", "graphTitle": "Graphs"
"description": "Select your preffered language!" },
"manage": {
"settings": {
"memberCount": "Members",
"info": {
"info": "Info",
"server": "Server Information"
}
}
},
"privacyPolicy": {
"title": "Privacy Policy",
"description": "Privacy Policy and Terms of Service",
"pp": "Complete Privacy Policy"
},
"partials": {
"sidebar": {
"dash": "Dashboard",
"manage": "Manage Guilds",
"commands": "Commands",
"pp": "Privacy Policy",
"admin": "Admin",
"account": "Account Pages",
"login": "Sign In",
"logout": "Sign Out"
},
"navbar": {
"home": "Home",
"pages": {
"manage": "Manage Guilds",
"settings": "Manage Guilds",
"commands": "Commands",
"pp": "Privacy Policy",
"admin": "Admin Panel",
"error": "Error",
"credits": "Credits",
"debug": "Debug",
"leaderboard": "Leaderboard",
"profile": "Profile",
"maintenance": "Under Maintenance"
}
},
"title": {
"pages": {
"manage": "Manage Guilds",
"settings": "Manage Guilds",
"commands": "Commands",
"pp": "Privacy Policy",
"admin": "Admin Panel",
"error": "Error",
"credits": "Credits",
"debug": "Debug",
"leaderboard": "Leaderboard",
"profile": "Profile",
"maintenance": "Under Maintenance"
}
},
"sweetalert": {
"success": {
"login": "Successfully logged in."
}
},
"preloader": {
"text": "Page is loading..."
},
"premium": {
"title": "Want more from JaBa?",
"description": "Check out premium features below!",
"buttonText": "Become Premium"
},
"settings": {
"title": "Site Configuration",
"description": "Configurable Viewing Options",
"theme": {
"title": "Site Theme",
"description": "Make the site more appealing for your eyes!"
},
"language": {
"title": "Site Language",
"description": "Select your preffered language!"
}
} }
} }
} }

View file

@ -1,91 +1,98 @@
{ {
"name": "Русский", "DASHBOARD": {
"index": { "name": "Русский",
"feeds": [ "Current User", "CPU", "System Platform", "Server Count" ], "index": {
"card": { "feeds": [ "Текущий пользователь", "Версия Node", "Кол-во пользователей", "Кол-во серверов" ],
"category": "JaBa Bot", "card": {
"title": "Simple bot made by <a href=\"https://github.com/JonnyBro\">Jonny_Bro</a>", "category": "JaBa Bot",
"description": "Upper Text", "title": "Простой бот, созданный <a href=\"https://github.com/JonnyBro\">Jonny_Bro</a>",
"image": "", "description": "Верхний текст",
"footer": "Bottom Text" "image": "",
}, "footer": "Нижний текст"
"feedsTitle": "Feeds",
"graphTitle": "Graphs"
},
"manage": {
"settings": {
"memberCount": "Members",
"info": {
"info": "Info",
"server": "Server Information"
}
}
},
"privacyPolicy": {
"title": "Privacy Policy",
"description": "Privacy Policy and Terms of Service",
"pp": "Complete Privacy Policy"
},
"partials": {
"sidebar": {
"dash": "Dashboard",
"manage": "Manage Guilds",
"commands": "Commands",
"pp": "Privacy Policy",
"admin": "Admin",
"account": "Account Pages",
"login": "Sign In",
"logout": "Sign Out"
},
"navbar": {
"home": "Home",
"pages": {
"manage": "Manage Guilds",
"settings": "Manage Guilds",
"commands": "Commands",
"pp": "Privacy Policy",
"admin": "Admin Panel",
"error": "Error",
"credits": "Credits",
"debug": "Debug",
"leaderboard": "Leaderboard",
"profile": "Profile",
"maintenance": "Under Maintenance"
}
},
"title": {
"pages": {
"manage": "Manage Guilds",
"settings": "Manage Guilds",
"commands": "Commands",
"pp": "Privacy Policy",
"admin": "Admin Panel",
"error": "Error",
"credits": "Credits",
"debug": "Debug",
"leaderboard": "Leaderboard",
"profile": "Profile",
"maintenance": "Under Maintenance"
}
},
"preloader": {
"text": "Page is loading..."
},
"premium": {
"title": "Want more from JaBa?",
"description": "Check out premium features below!",
"buttonText": "Become Premium"
},
"settings": {
"title": "Site Configuration",
"description": "Configurable Viewing Options",
"theme": {
"title": "Site Theme",
"description": "Make the site more appealing for your eyes!"
}, },
"language": { "feedsTitle": "Новости",
"title": "Site Language", "graphTitle": "Графики"
"description": "Select your preffered language!" },
"manage": {
"settings": {
"memberCount": "Участники",
"info": {
"info": "Информация",
"server": "Информация о сервере"
}
}
},
"privacyPolicy": {
"title": "Политика конф.",
"description": "Политика конфиденциальности и Условия использования",
"pp": "Полная политика конфиденциальности"
},
"partials": {
"sidebar": {
"dash": "Панель управления",
"manage": "Сервера",
"commands": "Команды",
"pp": "Политика конф.",
"admin": "Админ панель",
"account": "Аккаунт",
"login": "Войти",
"logout": "Выйти"
},
"navbar": {
"home": "Главная",
"pages": {
"manage": "Настройки серверов",
"settings": "Настройки",
"commands": "Команды",
"pp": "Политика конфиденциальности",
"admin": "Админ панель",
"error": "Ошибка",
"credits": "Разработчики панели",
"debug": "Отладка",
"leaderboard": "Таблица лидеров",
"profile": "Профиль",
"maintenance": "Техобслуживание"
}
},
"title": {
"pages": {
"manage": "Настройки серверов",
"settings": "Настройки",
"commands": "Команды",
"pp": "Политика конфиденциальности",
"admin": "Админ панель",
"error": "Ошибка",
"credits": "Разработчики панели",
"debug": "Отладка",
"leaderboard": "Таблица лидеров",
"profile": "Профиль",
"maintenance": "Техобслуживание"
}
},
"sweetalert": {
"success": {
"login": "Вход выполнен."
}
},
"preloader": {
"text": "Загрузка..."
},
"premium": {
"title": "Хотите большего JaBa?",
"description": "Проверьте Премиум функции!",
"buttonText": "Стать Премиум"
},
"settings": {
"title": "Настройки сайта",
"description": "Настройте параметры панели управления",
"theme": {
"title": "Тема",
"description": "У нас есть тёмная и светлая!"
},
"language": {
"title": "Язык",
"description": "Выберите предпочитаемый язык!"
}
} }
} }
} }

View file

@ -1,91 +1,98 @@
{ {
"name": "Українська", "DASHBOARD": {
"index": { "name": "Українська",
"feeds": [ "Current User", "CPU", "System Platform", "Server Count" ], "index": {
"card": { "feeds": [ "Поточний Користувач", "Версія Node", "Кількість користувачів", "Кількість серверів" ],
"category": "JaBa Bot", "card": {
"title": "Simple bot made by <a href=\"https://github.com/JonnyBro\">Jonny_Bro</a>", "category": "JaBa Бот",
"description": "Upper Text", "title": "Простий бот, створений <a href=\"https://github.com/JonnyBro\">Jonny_Bro</a>",
"image": "", "description": "Верхній Текст",
"footer": "Bottom Text" "image": "",
}, "footer": "Нижній Текст"
"feedsTitle": "Feeds",
"graphTitle": "Graphs"
},
"manage": {
"settings": {
"memberCount": "Members",
"info": {
"info": "Info",
"server": "Server Information"
}
}
},
"privacyPolicy": {
"title": "Privacy Policy",
"description": "Privacy Policy and Terms of Service",
"pp": "Complete Privacy Policy"
},
"partials": {
"sidebar": {
"dash": "Dashboard",
"manage": "Manage Guilds",
"commands": "Commands",
"pp": "Privacy Policy",
"admin": "Admin",
"account": "Account Pages",
"login": "Sign In",
"logout": "Sign Out"
},
"navbar": {
"home": "Home",
"pages": {
"manage": "Manage Guilds",
"settings": "Manage Guilds",
"commands": "Commands",
"pp": "Privacy Policy",
"admin": "Admin Panel",
"error": "Error",
"credits": "Credits",
"debug": "Debug",
"leaderboard": "Leaderboard",
"profile": "Profile",
"maintenance": "Under Maintenance"
}
},
"title": {
"pages": {
"manage": "Manage Guilds",
"settings": "Manage Guilds",
"commands": "Commands",
"pp": "Privacy Policy",
"admin": "Admin Panel",
"error": "Error",
"credits": "Credits",
"debug": "Debug",
"leaderboard": "Leaderboard",
"profile": "Profile",
"maintenance": "Under Maintenance"
}
},
"preloader": {
"text": "Page is loading..."
},
"premium": {
"title": "Want more from JaBa?",
"description": "Check out premium features below!",
"buttonText": "Become Premium"
},
"settings": {
"title": "Site Configuration",
"description": "Configurable Viewing Options",
"theme": {
"title": "Site Theme",
"description": "Make the site more appealing for your eyes!"
}, },
"language": { "feedsTitle": "Канали",
"title": "Site Language", "graphTitle": "Графіки"
"description": "Select your preffered language!" },
"manage": {
"settings": {
"memberCount": "Учасники",
"info": {
"info": "Інформація",
"server": "Інформація про Сервер"
}
}
},
"privacyPolicy": {
"title": "Політика Конфіденційності",
"description": "Політика Конфіденційності та Умови Сервісу",
"pp": "Повна Політика Конфіденційності"
},
"partials": {
"sidebar": {
"dash": "Панель Керування",
"manage": "Налаштування серверів",
"commands": "Команди",
"pp": "Політика Конфіденційності",
"admin": "Адмін",
"account": "Сторінки Аккаунта",
"login": "Увійти",
"logout": "Вийти"
},
"navbar": {
"home": "Головна",
"pages": {
"manage": "Налаштування серверів",
"settings": "Керувати",
"commands": "Команди",
"pp": "Політика Конфіденційності",
"admin": "Панель Адміністратора",
"error": "Помилка",
"credits": "Автори",
"debug": "Налагодження",
"leaderboard": "Таблиця Лідерів",
"profile": "Профіль",
"maintenance": "Технічне Обслуговування"
}
},
"title": {
"pages": {
"manage": "Керувати Гілдіями",
"settings": "Керувати",
"commands": "Команди",
"pp": "Політика Конфіденційності",
"admin": "Панель Адміністратора",
"error": "Помилка",
"credits": "Автори",
"debug": "Налагодження",
"leaderboard": "Таблиця Лідерів",
"profile": "Профіль",
"maintenance": "Технічне Обслуговування"
}
},
"sweetalert": {
"success": {
"login": "Вхід виконано."
}
},
"preloader": {
"text": "Завантаження..."
},
"premium": {
"title": "Бажаєте більше від JaBa?",
"description": "Ознайомтесь з преміум-функціями нижче!",
"buttonText": "Стати Преміум"
},
"settings": {
"title": "Налаштування Сайту",
"description": "Налаштовувані параметри перегляду",
"theme": {
"title": "Тема",
"description": "Зробіть сайт більш привабливим для своїх очей!"
},
"language": {
"title": "Мова",
"description": "Виберіть бажану мову!"
}
} }
} }
} }