All Projects → zeroxs → Aegis.cpp

zeroxs / Aegis.cpp

Licence: mit
Discord C++ library for interfacing with the API. Join our server:

Programming Languages

cpp
1120 projects
cpp17
186 projects
cpp14
131 projects

Projects that are alternatives of or similar to Aegis.cpp

Discord.js Menu
💬 Easily create Discord.js v12 embed menus with reactions and unlimited customizable pages.
Stars: ✭ 89 (-55.05%)
Mutual labels:  discord-api, bot, library, discord
Discord4j
Discord4J is a fast, powerful, unopinionated, reactive library to enable quick and easy development of Discord bots for Java, Kotlin, and other JVM languages using the official Discord Bot API.
Stars: ✭ 973 (+391.41%)
Mutual labels:  api, discord-api, bot, discord
Basicbot
A basic example of a Discord Bot written in Python. (discord.py)
Stars: ✭ 73 (-63.13%)
Mutual labels:  api, discord-api, bot, discord
Discordeno
Discord API library for Deno
Stars: ✭ 254 (+28.28%)
Mutual labels:  api, discord-api, library, discord
Nostrum
Elixir Discord Library
Stars: ✭ 274 (+38.38%)
Mutual labels:  discord-api, bot, library, discord
Javacord
An easy to use multithreaded library for creating Discord bots in Java.
Stars: ✭ 368 (+85.86%)
Mutual labels:  api, discord-api, bot, discord
Disgord
Go module for interacting with the documented Discord's bot interface; Gateway, REST requests and voice
Stars: ✭ 277 (+39.9%)
Mutual labels:  api, discord-api, bot, discord
Dsharpplus
A .NET Standard library for making bots using the Discord API.
Stars: ✭ 635 (+220.71%)
Mutual labels:  api, discord-api, bot, discord
Bot
A Discord bot for all your needs. With memes, utilities, moderation & more, Fire is the only bot you'll need.
Stars: ✭ 79 (-60.1%)
Mutual labels:  discord-api, bot, discord
Nino
🔨 Advanced and cute moderation discord bot as an entry of Discord's Hack Week!
Stars: ✭ 78 (-60.61%)
Mutual labels:  discord-api, bot, discord
Client
A Typescript NodeJS library to interact with Discord's API, both Rest and Gateway.
Stars: ✭ 84 (-57.58%)
Mutual labels:  discord-api, bot, discord
Discord.jl
The Julia Discord API Wrapper
Stars: ✭ 93 (-53.03%)
Mutual labels:  api, library, discord
Ccxt.net
CCXT.NET – CryptoCurrency eXchange Trading Library for .NET
Stars: ✭ 89 (-55.05%)
Mutual labels:  api, bot, library
Music Bot
Simple music bot with a full-blown queue system that is easy to understand
Stars: ✭ 102 (-48.48%)
Mutual labels:  discord-api, bot, discord
Dimscord
A Discord Bot & REST Library for Nim.
Stars: ✭ 67 (-66.16%)
Mutual labels:  api, discord-api, discord
Smorebot
SmoreBot is a fun, lightweight, multipurpose bot packed with features.
Stars: ✭ 51 (-74.24%)
Mutual labels:  discord-api, bot, discord
Node Sdk
An official module for interacting with the top.gg API
Stars: ✭ 90 (-54.55%)
Mutual labels:  api, bot, discord
Discord Haskell
Haskell library for writing Discord bots
Stars: ✭ 129 (-34.85%)
Mutual labels:  discord-api, bot, discord
Discord.js
discord.js is a powerful Node.js module that allows you to easily interact with the Discord API.
Stars: ✭ 16,432 (+8198.99%)
Mutual labels:  discord-api, bot, discord
Discord.net
An unofficial .Net wrapper for the Discord API (http://discordapp.com)
Stars: ✭ 2,253 (+1037.88%)
Mutual labels:  discord-api, bot, discord

Build Status Discord License

Aegis Library

C++14/17 library for interfacing with the Discord API

License

This project is licensed under the MIT license. See LICENSE

Libraries used (all are header-only with the exception of zlib and openssl):

TODO

  • Voice data send/recv
  • Finish documentation
  • Finish live example of library in use

Documentation

You can access the documentation here. It is a work in progress itself and has some missing parts, but most of the library is now documented.

Using this library

This library can be used compiled or as header only. All ways require recursive cloning of this repo. Some of the dependencies are version locked.

Header only

Including the helper header will automatically include all other files.

#include <aegis.hpp>

int main()
{
    aegis::core bot(aegis::create_bot_t().log_level(spdlog::level::trace).token("TOKEN"));
    bot.set_on_message_create([](auto obj)
    {
        if (obj.msg.get_content() == "Hi")
            obj.msg.get_channel().create_message(fmt::format("Hello {}", obj.msg.author.username));
    });
    bot.run();
    bot.yield();
}

Separate compilation

You can include #include <aegis/src.hpp> within a single cpp file while defining -DAEGIS_SEPARATE_COMPILATION, have #include <aegis.hpp> in your program, then build as usual.

Shared/Static library

You can build this library with CMake.

$ git clone --recursive https://github.com/zeroxs/aegis.cpp.git
$ cd aegis.cpp
$ mkdir build
$ cd build
$ cmake ..
// or to use C++17
$ cmake -DCMAKE_CXX_COMPILER=g++-7 -DCMAKE_CXX_STANDARD=17 ..

You can also add -DBUILD_EXAMPLES=1 and it will build 3 examples within the ./src directory.
example_main.cpp;example.cpp will build a bot that runs out of its own class
minimal.cpp will build two versions, one (aegis_minimal) will be with the shared/static library. The other (aegis_headeronly_no_cache) will be header-only but the lib will store no internal cache.

Compiler Options

You can pass these flags to CMake to change what it builds
-DBUILD_EXAMPLES=1 will build the examples
-DCMAKE_CXX_COMPILER=g++-7 will let you select the compiler used
-DCMAKE_CXX_STANDARD=17 will let you select C++14 (default) or C++17

Library

You can pass these flags to your compiler (and/or CMake) to alter how the library is built
-DAEGIS_DISABLE_ALL_CACHE will disable the internal caching of most objects such as member data reducing memory usage by a significant amount
-DAEGIS_DEBUG_HISTORY enables the saving of the last 5 messages sent on the shard's websocket. In the event of an uncaught exception, they are dumped to console.
-DAEGIS_PROFILING enables the usage of 3 callbacks that can help track time spent within the library. See docs:

  1. aegis::core::set_on_message_end Called when message handler is finished. Counts only your message handler time.
  2. aegis::core::set_on_js_end Called when the incoming json event is parsed. Counts only json parse time.
  3. aegis::core::set_on_rest_end Called when a REST (or any HTTP request is made) is finished. Counts only entire HTTP request time and includes response status code.
Your project

Options above, as well as: -DAEGIS_DYN_LINK used when linking the library as a shared object
-DAEGIS_HEADER_ONLY to make library header-only (default option)
-DAEGIS_SEPARATE_COMPILATION used when linking the library as static or separate cpp file within your project

CMake misc

If configured with CMake, it will create a pkg-config file that may help with compiling your own project.
It can be used as such:
g++ -std=c++14 myfile.cpp $(pkg-config --cflags --libs aegis)
to link to the shared object

g++ -std=c++14 myfile.cpp $(pkg-config --cflags --libs aegis_static)
to link to the static object

You can also use this library within your own CMake project by adding find_package(Aegis REQUIRED) to your CMakeLists.txt.

Config

You can change basic configuration options within the config.json file. It should be in the same directory as the executable.

{
	"token": "BOTTOKENHERE",
	"force-shard-count": 10,
	"file-logging": false,
	"log-format": "%^%Y-%m-%d %H:%M:%S.%e [%L] [th#%t]%$ : %v"
}

Alternatively you can configure the library by passing in the create_bot_t() object to the constructor of the aegis::core object. You can make use of it fluent-style.

aegis::core(aegis::create_bot_t().log_level(spdlog::level::trace).token("TOKEN"))
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].