Skip to content

Latest commit

 

History

History
174 lines (162 loc) · 5.97 KB

README.md

File metadata and controls

174 lines (162 loc) · 5.97 KB

KINGMAN DEV

Discord Handler


About This Handler

The Ultimate Discord.js Handler Template which handles fast and effectively Commands and Events.
This project was written using typescript Which may help you get help when using the code editor.

Features

  • prefix command handler
  • message command handler
  • user command handler
  • buttons handler
  • select menu handler
  • modal handler
  • kmcodes message manager
  • [email protected]

install and run

Download the project and extract the files, then go to the extracted file

Download the project

or you can download the project using git

git clone https://github.com/KMKINGMAN/discord-handler.git
cd discord-handler

Open Terminal/shell or cmd and download the packages via the command

npm install

Now create an .env file and put your bot informationon it or just use src/config.json file

token=BOT_TOKEN
prefix=BOT_PREFIX
mongo=MONGO DB CONNECTION LINK
client_id=YOUR_BOT_ID

Start the project using

npm start

How to use the events handler

Go to src/events/ Create a single group by creating a new folder
Go to the folder and then create a new file that should end in typescript for example src/events/start/ready.ts now paste a template for events handler

import { EventsTyper } from "../../lib/handler/events";
export let events = {
    name: "", // event name
    async run(client){ // event callback
	//You Code Here
    }
} as EventsTyper;

How to use the command handler

Go to src/commands/ Create a single group by creating a new folder
Go to the folder and then create a new file that should end in typescript for example src/commands/start/hello.ts now paste a template for command handler

prefix command template
import { ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, ModalActionRowComponentBuilder, ButtonBuilder, ButtonStyle, SelectMenuBuilder } from "discord.js";
import { CommandFilerType } from "../../lib/handler/command";
export let command = {
    general: {
        name: "", // command name
        async run(client, message, args, manager) {//Callbak
            //Your Code Here
        },
    }
} as CommandFilerType
message command template
import { ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, ModalActionRowComponentBuilder, ButtonBuilder, ButtonStyle, SelectMenuBuilder } from "discord.js";
import { CommandFilerType } from "../../lib/handler/command";
export let command = {
 message_command: {
        id: "", // command id
        async run(client, interaction) {
		//Your Code Here
        },
    },
} as CommandFilerType
slash command template
import { ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, ModalActionRowComponentBuilder, ButtonBuilder, ButtonStyle, SelectMenuBuilder } from "discord.js";
import { CommandFilerType } from "../../lib/handler/command";
export let command = {
slachcmd: {
        name: "", //Command Name
        description: "", // Command des
        permissions: { // You can use it or just remove it
            me: "",
            bot: ""
        },
		options: [], // [<ApplicationCommandOptionData>]You Can use it or just remove it 
        async run(client, interaction) {
		 //Your Code Here
		})
        },
    },
} as CommandFilerType
user command template
import { ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, ModalActionRowComponentBuilder, ButtonBuilder, ButtonStyle, SelectMenuBuilder } from "discord.js";
import { CommandFilerType } from "../../lib/handler/command";
export let command = {
    user_command: {
        id: "",//Command id
        async run(client, interaction){
		//Your Code
        }
    },
} as CommandFilerType
modal command template
import { ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, ModalActionRowComponentBuilder, ButtonBuilder, ButtonStyle, SelectMenuBuilder } from "discord.js";
import { CommandFilerType } from "../../lib/handler/command";
export let command = {
    modal: {
        id: "",//Command ID
        async run(client, interaction) {
		//Your Code Here
        },
    },
} as CommandFilerType
select_menu command template
import { ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, ModalActionRowComponentBuilder, ButtonBuilder, ButtonStyle, SelectMenuBuilder } from "discord.js";
import { CommandFilerType } from "../../lib/handler/command";
export let command = {
 select_menu: {
        id: "",//Commad ID
        async run(client, interaction) {
		//Your Code Here
        },
    },
} as CommandFilerType
buttons command template
import { ModalBuilder, TextInputBuilder, TextInputStyle, ActionRowBuilder, ModalActionRowComponentBuilder, ButtonBuilder, ButtonStyle, SelectMenuBuilder } from "discord.js";
import { CommandFilerType } from "../../lib/handler/command";
export let command = {
    buttons: [{ // ITS ARRAY YOU CAN USE MORE THAN ONE BTN
        id: "",//Button id
        async run(client, interaction) {
		//Your Code Here
        },
    }]
} as CommandFilerType

You can use them all in one file see src/commands/test/test-message.ts

Support

my telegram channel: https://t.me/kingman4hack
my instagram: https://instagram.com/km.kingman
Don't forget to give me a credits if you use my project