toowake

index.js

Sep 9th, 2023
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const { AttachmentBuilder, MessageType, Client, Partials, GatewayIntentBits, PermissionFlagsBits, EmbedBuilder, PermissionsBitField, Permissions, MessageManager, Embed, Collection, Events, AuditLogEvent, MessageCollector, ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, ButtonBuilder, ButtonStyle, ChannelType } = require(`discord.js`);
  2. const fs = require('fs');
  3. const os = require("os");
  4.  
  5. const client = new Client({
  6.   intents: [
  7.         GatewayIntentBits.Guilds,
  8.         GatewayIntentBits.GuildMessages,
  9.         GatewayIntentBits.MessageContent,
  10.         GatewayIntentBits.GuildMessageReactions,
  11.         GatewayIntentBits.GuildPresences,
  12.         GatewayIntentBits.GuildMembers,
  13.         GatewayIntentBits.GuildVoiceStates,
  14.         GatewayIntentBits.GuildInvites,
  15.         GatewayIntentBits.GuildModeration,
  16.         GatewayIntentBits.DirectMessages,
  17.         GatewayIntentBits.DirectMessageReactions,
  18.         GatewayIntentBits.DirectMessageTyping,
  19.   ],
  20.   partials: [
  21.       Partials.Channel,
  22.       Partials.Reaction,
  23.       Partials.Message
  24.   ],
  25.   allowedMentions: {
  26.   parse: [`users`, `roles`],
  27.   repliedUser: true,
  28.   }
  29. });
  30.  
  31. const Discord = require('discord.js');
  32.  
  33. client.commands = new Collection();
  34.  
  35. require('dotenv').config();
  36.  
  37. const functions = fs.readdirSync("./src/functions").filter(file => file.endsWith(".js"));
  38. const eventFiles = fs.readdirSync("./src/events").filter(file => file.endsWith(".js"));
  39. const commandFolders = fs.readdirSync("./src/commands");
  40.  
  41. let errorData = [];
  42. //JSON Error log
  43. try {
  44.     const errorLog = fs.readFileSync('errorLog.json', 'utf-8');
  45.     errorData = JSON.parse(errorLog)
  46. } catch (error) {
  47. }
  48.  
  49. //Anti Crash System
  50. const process = require("node:process");
  51. const mainGuild = process.env.MAINGUILDID;
  52. const owner = process.env.OWNERID;
  53. const justin = process.env.JUSTIN;
  54.  
  55. (async () => {
  56.     for (file of functions) {
  57.         require(`./functions/${file}`)(client);
  58.     }
  59.     client.handleEvents(eventFiles, "./src/events");
  60.     client.handleCommands(commandFolders, "./src/commands");
  61.     client.login(process.env.token)
  62. })();
  63.  
  64. module.exports = client;
  65. // Define Packages
  66. const SoftUI = require('dbd-soft-ui');
  67. const config = require('../config.json');
  68. let DBD = require('discord-dashboard');
  69.  
  70. //category for commands
  71. const moderation = require("../Categorys/moderation");
  72. const community = require("../Categorys/community");
  73. const leveling = require("../Categorys/leveling");
  74. const warnsys = require("../Categorys/warnsys");
  75. const ecosys = require("../Categorys/economy");
  76. const mail = require("../Categorys/modmail");
  77. const nsfw = require("../Categorys/nsfw");
  78. const other = require("../Categorys/other");
  79. const sys = require("../Categorys/systems");
  80.  
  81. //Setups
  82. const welcomeSetup = require('../Systems/welcome');
  83. const logsSetup = require('../Systems/logs');
  84. const modmailSetup = require('../Systems/modmail');
  85. const jtcSetup = require('../Systems/jtc');
  86. const ticketSetup = require('../Systems/ticket');
  87. const giveawaySetup = require('../Systems/giveaway');
  88.  
  89. //some imports
  90. const Maintenance = require("../Data/underMaintenance");
  91.  
  92. //handler
  93. const Handler = new DBD.Handler();
  94.  
  95. //Locales
  96. const LOCALES = require("../Locales/locales");
  97.  
  98. //Dashboard
  99. (async ()=>{
  100.     await DBD.useLicense(config.dbd.license);
  101.     DBD.Dashboard = DBD.UpdatedClass();
  102.  
  103.     const Dashboard = new DBD.Dashboard({
  104.         acceptPrivacyPolicy: true,
  105.         useCategorySet: true,
  106.         //Support Server
  107.         supportServer: {
  108.             slash: '/support-server',
  109.             inviteUrl: 'https://discord.gg/z8nxPve4pn'
  110.         },
  111.         //Port
  112.         port: config.dbd.port,
  113.         //client
  114.         client: config.discord.client,
  115.         //redirect
  116.         redirectUri: `${config.dbd.domain}${config.dbd.redirectUri}`,
  117.         //domain
  118.         domain: config.dbd.domain,
  119.         //owners
  120.         ownerIDs: config.dbd.ownerIDs,
  121.         //Maintenance
  122.         useThemeMaintenance: true,
  123.         useTheme404: true,
  124.         //Join server
  125.         guildAfterAuthorization: {
  126.             use: true,
  127.             guildId: "1121353922355929129"
  128.         },
  129.         //Invite
  130.         invite: {
  131.             clientId: config.discord.client.id,
  132.             scopes:["bot", "applications.commands"],
  133.             permissions: '10982195068151',
  134.         },
  135.         //underMaintenance
  136.         underMaintenance: Maintenance,
  137.         //Permissions
  138.         requiredPermissions: DBD.DISCORD_FLAGS.Permissions.ADMINISTRATOR,
  139.         //Logs
  140.         minimizedConsoleLogs: true,
  141.         //client
  142.         bot: client,
  143.         //Theme
  144.         theme: SoftUI({
  145.             locales: LOCALES,
  146.             dbdriver: config.database.mongose,
  147.             storage: Handler,
  148.             colorScheme: "blue",
  149.             /*themeColors: {
  150.                 secondaryColor: "#000000",
  151.                 primaryColor: "#ff0000"
  152.             },*/
  153.             customThemeOptions: {
  154.                 index: async ({ req, res, config }) => {
  155.                     let username = req.session?.user?.username || "Guest"
  156.  
  157.                     const cards = [
  158.                         {
  159.                             title: "Current User",
  160.                             icon: "single-02",
  161.                             getValue: username,
  162.                             progressBar: {
  163.                                 enabled: false,
  164.                                 getProgress: client.guilds.cache.size
  165.                             }
  166.                         },
  167.                         {
  168.                             title: "CPU",
  169.                             icon: "settings",
  170.                             getValue: os.cpus()[0].model.replace('(R) Core(TM) ', ' ').replace(' CPU ', '').split('@')[0],
  171.                             progressBar: {
  172.                                 enabled: false,
  173.                                 getProgress: 50
  174.                             }
  175.                         },
  176.                         {
  177.                             title: "System Platform",
  178.                             icon: "single-02",
  179.                             getValue: os.platform(),
  180.                             progressBar: {
  181.                                 enabled: false,
  182.                                 getProgress: 50
  183.                             }
  184.                         },
  185.                         {
  186.                             title: "Server count",
  187.                             icon: "single-02",
  188.                             getValue: `${client.guilds.cache.size} Guilds`,
  189.                             progressBar: {
  190.                                 enabled: true,
  191.                                 getProgress: (client.guilds.cache.size / 100) * 100
  192.                             }
  193.                         }
  194.                     ]
  195.  
  196.                     const graph = {
  197.                         values: [690, 524, 345, 645, 478, 592, 468, 783, 459, 230, 621, 345],
  198.                         labels: ["1m", "2m", "3m", "4m", "5m", "6m", "7m", "8m", "9m", "10m"]
  199.                     }
  200.  
  201.                     return {
  202.                         cards,
  203.                         graph,
  204.                         values: [],
  205.                         premium: []
  206.                     }
  207.                 },
  208.             },
  209.             websiteName: "Nexus",
  210.             websiteTitle: "NEXUS - imagine a free discord bot",
  211.             dashboardURL: config.dbd.domain,
  212.             supporteMail: "[email protected]",
  213.             createdBy: "Nexus Development",
  214.             icons: {
  215.                 favicon: "https://cdn.discordapp.com/attachments/1147892533855260823/1147934381491634346/20230903_183644.png",
  216.                 noGuildIcon: "https://unlimitedworld.de/attachments/discord-mark-blue-png.64362/",
  217.                 sidebar: {
  218.                     darkUrl: 'https://cdn.discordapp.com/attachments/1147892533855260823/1147934381491634346/20230903_183644.png',
  219.                     lightUrl: 'https://cdn.discordapp.com/attachments/1147892533855260823/1147934317553664070/20230903_183622.png',
  220.                     hideName: false,
  221.                     borderRadius: true,
  222.                     alignCenter: true
  223.                 },
  224.             },
  225.             index: {
  226.                 card: {
  227.                     category: "Nexus",
  228.                     title: "NEXUS - imagine a free discord bot",
  229.                     description: "NEXUS Panel",
  230.                     image: "https://cdn.discordapp.com/attachments/1147892533855260823/1147934381491634346/20230903_183644.png",
  231.                     link: {
  232.                         enabled: true,
  233.                         url: config.dbd.domain + "/commands"
  234.                     },
  235.                 },
  236.                  premium: {
  237.                     enabled: true,
  238.                     card: {
  239.                         title: "Want to suport this project?",
  240.                         description: "You can become premium!",
  241.                         bgImage: "https://cdn.discordapp.com/attachments/1112743789782638602/1147933261843157013/20230903_183622.png",
  242.                         button: {
  243.                             text: "Become Premium",
  244.                             url: "https://patreon.com/nexusdevelopment"
  245.                         }
  246.                     }
  247.                 },
  248.                 feeds: {
  249.                     category: "feeds",
  250.                     title: "Feed",
  251.                     description: "NEXUS Panel is still in progress. For questions and suggestions join our discord server!",
  252.                     footer: "NEXUS"
  253.                 },
  254.                 information: {
  255.                     category: "information",
  256.                     title: "Information",
  257.                     description: "Nexus is the most powerful bot on discord. Its 100% free with no ads etc. Lets make paid bots useless.",
  258.                     footer: "NEXUS"
  259.                 },
  260.                 graph: {
  261.                     enabled: true,
  262.                     lineGraph: false,
  263.                     title: 'Memory Usage',
  264.                     tag: 'Memory (MB)',
  265.                     max: 100
  266.                 },
  267.                
  268.             },
  269.             footer: {
  270.                 replaceDefault: true,
  271.                 text: "Made by Nexus Development"
  272.             },
  273.             sweetalert: {
  274.                 errors: {},
  275.                 success: {
  276.                     login: "you have been logged in!",
  277.                 }
  278.             },
  279.             preloader: {
  280.                 image: "https://cdn.discordapp.com/attachments/1112743789782638602/1147938332307898418/discord-avatar-512-E9R4D.gif",
  281.                 spinner: false,
  282.                 text: "Loading page...",
  283.             },
  284.             admin: {
  285.                 pterodactyl: {
  286.                     enabled: false,
  287.                     apiKey: "apiKey",
  288.                     panelLink: "https://panel.website.com",
  289.                     serverUUIDs: []
  290.                 },
  291.             },
  292.             commands: [
  293.                 moderation,
  294.                 community,
  295.                 leveling,
  296.                 warnsys,
  297.                 ecosys,
  298.                 mail,
  299.                 sys,
  300.                 nsfw,
  301.                 other,
  302.             ]}),
  303.             settings: [
  304.                 welcomeSetup,
  305.                 logsSetup,
  306.                 modmailSetup,
  307.                 jtcSetup,
  308.                 ticketSetup,
  309.                 giveawaySetup
  310.             ],
  311.     });
  312.     Dashboard.init();
  313. })();
  314.  
  315. client.login(process.env.TOKEN).then(console.log("Client logged in"))
Advertisement
Add Comment
Please, Sign In to add comment