C Multi-REST API library for Discord, Slack, Reddit, etc.
C Multi-REST API library for Discord, Slack, Reddit, etc.
Orca is implemented in plain C, its symbols are organized to be easily matched to the documentation of the API being covered.
This is done in order to:
Orca's implementation has minimum external dependencies to make bot deployment deadly simple.
Easy to reason about the code: the most native data structures, the simplest algorithms, and intuitive interfaces.
Easy to debug (networking and logic) errors: extensive assertion and logging facilities.
Easy to use for the end users: highly scalable, all transfers made with Orca are thread-safe.
…This is a minimalistic example, refer to examples/ for a better overview.
The only dependency is curl-7.4.1 or higher
$ sudo apt install -y build-essential libcurl4-openssl-dev$ sudo xbps-install -S libcurl-devel$ git clone https://github.com/cee-studio/orca.git && cd orca$ makeThe following outlines the default fields of config.json
…config.json,
by assigning it to discord's "token" field. There are
well written instructions from the
discord-irc
about how to get your bot token and adding it to a server.$ make examples$ cd examples && ./bot-echoType a message in any channel the bot is part of and the bot should send an echo response in return.
With Ctrl+c or by closing the Terminal.
my_bot/, a special folder set-up for your convenience that may be modified freely.Orca can be installed in case developing inside of my_bot/ doesn't suit your needs:
$ sudo make installIncluded headers must be orca/ prefixed:
#include <orca/discord.h>$ gcc myBot.c -o myBot -pthread -ldiscord -lcurl$ clang myBot.c -o myBot -pthread -ldiscord -lcurlFirst, make sure your executable is compiled with the -g flag to ensure human-readable debugger messages.
Using valgrind to check for memory leaks:
$ valgrind --leak-check=full ./myBotFor a more comprehensive guide check Valgrind's Quick Start.
Using GDB to check for runtime errors, such as segmentation faults:
$ gdb ./myBotAnd then execute your bot from the gdb environment:
(gdb) runIf the program has crashed, get a backtrace of the function calls leading to it:
(gdb) btFor a more comprehensive guide check Beej's Quick Guide to GDB
Problems? Check out our Discord Server.
Check our Contributing Guidelines to get started! If you are here for the Discord API, please check our Discord API Roadmap.
Give us a star if you like this project!
NULL Pointer in ntl_to_buf()
Request New Forum Channel Support
Timeout API support
loginfo does not work even with logconf as false
Incomplete Emoji Creation Function
Wrap the remaining Discord Endpoints