dna-discord-framework

1.0.187 • Public • Published

DNA-Discord-Framework

NPM package with bundled functionality allowing for advanced and quick development of Discord Bots

Create a New Project with DNA-Discord-Framework

Run the Following command to create a new Project. Project name can be in capitals.

npx create-dna-discord-bot <ProjectName>

To test it out immediatly run. If you haven't set up your Discord Bot follow the Getting Started Section.

npm run start

Installing through NPM

npm install dna-discord-framework

Getting Started

The following will show the basics on how to get a new project started, hosting the bot and running your first command.

Setup Project

Head over to your preffered Code editor, the folowing will use VS Code.

Run the following Command to make a new Project

npx create-dna-discord-bot <ProjectName>

image

Open it in VS Code by running the following 2 Commands

cd <ProjectName>
code .

image

VS Code should now be open with a similar file structure to the following.

image

In your VS Code Terminal type the following to start the Discord Bot

npm run start

image

You will be prompted to provide a Token, to do this you must create a Discord Application, invite it to a server and then Generate a token for it.

image

Create Discord Application

Start by heading over to Discord Applications and Login using your Discord Account

You will then receive a page looking like the following image

Click on the "New Application" Button.

You will be prompted to name the Discord Bot, and agree to the Terms and click "Create"

image

This leads you to the Following page

image

You can fill out this information to customize your bot and give it personality. You can fill this out later.

Setup Bot and Invite to Server

Go to the "Bot" Tab.

Make sure you turn the "Public Bot" Setting Off and turn on all the Settings in "Priveleged Gateway Intents"

image

Head over to the "OAuth2" Tab.

image

In the OAuth URL Generator section select the "Bot" and "application.commands" boxes

image

To avoid issues in the future check the Administrator boxes, this gives all permissions to the Bot. Once you're more familiar with setting up a bot you can be more selective

image

At the bottom of the Page a URL will be generated copy it

image

Inviting Requires Admin Priviliges

Paste it in the Server you want to invite it to and Click on it.

image

image

Click "Continue"

Click "Authorize"

image

The Bot should now be added.

image

If Successful they should appear in the Server.

image

The Bot can't be used and Won't be online until you make your own Discord Project

Generating Token and Login

Back in Discord Applications, go to the "Bot" Tab

image

Click the "Reset Token" Button, you may be prompted for a 2 Factor Authentication if you have that set up

It will then show your token with a "Copy" button.

Do Not Share Your Token Anywhere

If shared you Bot can be comprimised. Discord will also search for your token and if found on the internet will deactivate it.

image

Copy your Token and paste it in the Command Line for the Program. You should receive something similar

image

If you have invited the Bot to multiple Servers you may be prompted to input the name of the Server you want it connected to.

Notice that a Resource Folder is created with the Bots Data and a Log file. Make sure to add these files to your GitIgnore in order not to compromise your Token or other important information

image

Going back to Discord, you should notice that your Bot is now online

image

Run your First Command

The Bot comes with a few default Commands. With a new Project it comes with the Hello World Command

In the Discord Server start typing "/helloworld"

The command should appear in a Window

image

Click on the Name to complete it and then Run the Command.

image

image

Creating your own Command

Package Sidebar

Install

npm i dna-discord-framework

Weekly Downloads

3

Version

1.0.187

License

ISC

Unpacked Size

2.03 MB

Total Files

106

Last publish

Collaborators

  • mrdna