Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const config = require('./config.json')
- const Discord = require('discord.js');
- const fs = require("fs");
- const bot = new Discord.Client({fetchAllMembers: true, disableEveryone: true});
- const monnaie = require('./monnaie.json');
- const exp = require('./exp.json');
- const DBL = require("dblapi.js");
- const dbl = new DBL('eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjUwNTgzMDI1OTUxNDY3MTEyOSIsImJvdCI6dHJ1ZSwiaWF0IjoxNTQ3MzAwMTIyfQ.jT3fW6JWIv-3TEe3IIk0aed3pUx-PtMdMbLlGuDT-xc', bot);
- const { promisify } = require("util");
- const readdir = promisify(require("fs").readdir);
- const Enmap = require("enmap");
- const klaw = require("klaw");
- const path = require("path");
- const Collection = require("discord.js")
- const Client = require("discord.js");
- class Solezi extends Client {
- constructor(option) {
- super(option);
- this.settings = new Enmap({
- name: "settings",
- cloneLevel: "deep",
- fetchAll: false,
- autoFetch: true
- });
- this.config = require("./config.js");
- this.commands = new Collection();
- this.aliases = new Collection();
- this.settings = new enmap({
- name: "settings",
- cloneLevel: "deep",
- fetchAll: false,
- autoFetch: true
- });
- this.logger = require("./modules/Logger");
- this.wait = require("util").promisify(setTimeout);
- };
- loadCommand(commandPath, commandName) {
- try{
- const props = new (require(`${commandPath}${path.sep}${commandName}`))(this);
- this.logger.log(`Chargement de la commande : ${props.help.name}`, "log");
- props.conf.location = commandPath;
- if (props.init) {
- props.init(this);
- }
- this.commands.set(props.help.name, props);
- props.conf.aliases.forEach(alias => {
- this.aliases.set(alias,props.help.name)
- });
- return false;
- } catch (e) {
- return `Une erreur est survenue avec la commande : ${commandName}`;
- }
- }
- getSettiings(guild) {
- const defaults = this.config.defaultSettings || {};
- const guildData = this.settings.get(guild.id) || {};
- const returnObjet = {};
- Object.keys(defaults).forEach(key => {
- returnObjet[key] = guildData[key] ? guildData[key] : defaults[key];
- });
- return returnObjet;
- }
- }
- const client = new Solezia();
- //initialisation des commandes
- const init = async () => {
- klaw("./commands").on("data", item => {
- const cmdFile = path.parse(item.path);
- if (!cmdFile.ext || cmdFile.ext !== ".js ") return ;
- const reponse = client.loadCommand(cmdFile.dir , `${cmdFile.name}${cmdFile.ext}`);
- if (reponse) client.logger.error(reponse);
- });
- }
- init();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement