GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - brainboxdotcc/command_example: An example of splitting slash commands into separate files using D++

BranchesTags
Open more actions menu

Latest commit

 

History

12 Commits
12 Commits

Folders and files

NameName
Last commit message
Last commit date
cmake
cmake
 
 
include/command_example
include/command_example
 
 
src
src
 
 
.gitignore
.gitignore
 
 
CMakeLists.txt
CMakeLists.txt
 
 
CONTRIBUTING.md
CONTRIBUTING.md
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

D++ Multiple Command Example

This is a C++ bot for demonstrating a simple way to have each command in a separate file while using the D++ library.

There are many ways to approach this, and this method is an example of how to do it without having to have a base class and inheritence. All that is needed in each command file is one function which matches a format declares in command.h.

Three sample commands are implemented called ping, info and help.

Compilation

mkdir build
cd build
cmake ..
make -j

If DPP is installed in a different location you can specify the root directory to look in while running cmake

cmake .. -DDPP_ROOT_DIR=<your-path>

Running the bot

Create a config.json in the directory above the build directory:

{
"token": "your bot token here", 
}

Start the bot:

cd build
./command_example

Using the bot:

Type any one of the three example commands to see it running. Note that this bot registers global commands, and uses bulk registration, so any other global commands registered upon this bot token will be replaced by the three examples in this program!

About

An example of splitting slash commands into separate files using D++

dpp.dev/

Topics

cppcpp17discorddiscord-apidiscord-api-v10discord-api-wrapperdiscord-botdpp

Resources

Readme
Apache-2.0 license

Contributing

Contributing
Activity
Custom properties

Stars

7 stars

Watchers

3 watching

Forks

1 fork
Report repository

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.