Git Product home page Git Product logo

devxorhandler's Introduction

DevXorHandler

Introduction

DevXorHandler is a handler designed for discord.js that simplifies the management of codes, inputs, outputs, buttons, and menus in Discord bots. Additionally, DevXorHandler supports database integration using the good.db library.

Requirements

To install and use DevXorHandler, you need to install the following libraries:

You can install these libraries using npm:

npm install [email protected]
npm install [email protected]

Then install the other required dependencies using npm install

Features

  • Code Management: Easily manage and organize your bot's code.
  • Input and Output Handling: Efficiently handle user inputs and bot outputs.
  • Buttons and Menus: Create and manage interactive buttons and menus.
  • Database Support: Integrate with good.db for database operations.

Getting Started

Setting Up

  1. Install Required Libraries: Make sure you have installed discord.js and good.db as mentioned above.
  2. Create a New Project:
mkdir my-discord-bot
cd my-discord-bot
npm init -y
git clone https://github.com/DevXor-Team/DevXorHandler.git
npm install 

If git is avaliable

git clone https://github.com/DevXor-Team/DevXorHandler.git 
npm install 

Example Usage

Here's a basic example of how to set up DevXorHandler in your project:

if you want to added custom client options discord.js

go to index.js

let client = new DevXor({
  token: process.env.token, // the token of your bot

  // ! if you want to use custom Client Options <Discord.js>ClientOptions
  CustomClientOptions:{
    intents: [
      GatewayIntentBits.Guilds,
      GatewayIntentBits.GuildMembers,
      ...GatewayIntentBits,
    ]
  }
});

// if you put token in configuration  
// client.botlogin(token || process.env.token);
client.botlogin();

// or use
client.login(process.env.token)

if you want to change the default database configuration in your project use

  database: {
    // ! if use database_type "JSON" Default path in @root/database/database.json
    // ! if use database_type "SQLite" Default path in @root/database/database.Sqlite
    database_type: "MONGODB", // "MONGODB"|"Sqlite"|"JSON"|"MySQL"
    MongoDB: {
      database: "DevXor",
      uri: "mongodb://0.0.0.0:27017",
    },
    // ! if use database_type "MySQL"
    // MySQL: {
    //   database: "DevXor", // you can change the database name 
    //   host: "localhost", // your host or ip 
    //   port: 3306, // your port default 3306
    //   user: "farghaly", // your username
    //   password: "123" // your password
    // },

    // ! if using cache system in works space and modified any data in database manually,
    // ! not edit in cache manager an not modified data show
    // ! في حالة استخدام نظام ذاكرة التخزين المؤقت في مساحة العمل وتعديل أي بيانات في قاعدة البيانات يدويًا،
    // ! لا يتم التعديل في مدير ذاكرة التخزين المؤقت، وتظهر بيانات غير معدلة
    options: {
      table: "DevXorDB",
      nested: "..", //default use it 
      nestedIsEnabled: true, //default use it 
      cache: {
        capacity: 1024, //default use it 
        isEnabled: true, //default use
      },
    }
  }

if you want to create a new command ex.

go path - src/commands/public creat file ping

/**
 * @type {import("@utils/types/baseCommand")}
 */
module.exports = {
  // Command configuration
  name: "ping",
  description: "Test the bots response time",
  category: "UTILITY",
  botPermissions: ["SendMessages"],
  userPermissions: ["SendMessages"],
  cooldown: 1000,
  command: { enabled: true, minArgsCount: 1 },
  slashCommand: { enabled: true },

  // Message command execution
  async msgExecute(client, message, args) {
    try {
      // Reply with bot's response time
      message.reply({ content: `:ping_pong: **Pong ${client.ws.ping} ms**` });
    } catch (err) {
      console.log(err);
    }
  },

  // Slash command execution
  async interactionExecute(client, interaction) {
    try {
      // Reply with bot's response time
      interaction.reply({ content: `:ping_pong: **Pong ${client.ws.ping} ms**`, ephemeral: true });
    } catch (err) {
      console.log(err);
    }
  },
};

Put your secret variables in env file

token , WEBHOOK and any variables you want to access in the environment

Contributing

If you would like to contribute to DevXorHandler, please fork the repository and submit a pull request. We welcome all contributions!

License

This project is licensed under the MIT License. See the LICENSE file for more details.

Support

For support and questions, please open an issue on the DevXorHandler or join discord server at DevXor

Happy coding!

devxorhandler's People

Contributors

omar00050 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.