All Projects → cee-studio → orca

cee-studio / orca

Licence: MIT license
C Multi-REST API library for Discord, Slack, Reddit, etc.

Programming Languages

c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to orca

CwsShareCount
PHP class to get social share count for Delicious, Facebook, Google+, Linkedin, Pinterest, Reddit, StumbleUpon and Twitter.
Stars: ✭ 13 (-96.39%)
Mutual labels:  reddit, curl
context-mod
an event-based, reddit moderation bot built on top of snoowrap and written in typescript
Stars: ✭ 38 (-89.44%)
Mutual labels:  reddit
cj
正方教务系统成绩查询手机版,结合Weui,自动识别验证码
Stars: ✭ 20 (-94.44%)
Mutual labels:  curl
cat-message
Finds cat images/videos/gifs on reddit, sends them to my mom via applescript
Stars: ✭ 35 (-90.28%)
Mutual labels:  reddit
top-of-reddit
Top Reddit posts every day.
Stars: ✭ 22 (-93.89%)
Mutual labels:  reddit
Fetch
Asynchronous HTTP client with promises.
Stars: ✭ 29 (-91.94%)
Mutual labels:  curl
gencord
A simple, beginner-friendly, and easy-to-use library for interacting with the Discord API, with minimal syntax.
Stars: ✭ 20 (-94.44%)
Mutual labels:  discord-api
acord
An API wrapper for discord, built using aiohttp and pydantic.
Stars: ✭ 25 (-93.06%)
Mutual labels:  discord-api
ducky
Chrome extension to overlay a (super adorable) rubber duck, as a virtual companion during rubber duck debugging.
Stars: ✭ 80 (-77.78%)
Mutual labels:  reddit
Karuma
Karuma is a Discord Bot including Nukes, Raids, Mass DM and other features. Only for educational purposes 🥱🚀
Stars: ✭ 132 (-63.33%)
Mutual labels:  discord-api
Reddnet
🎭 Minimal Reddit clone
Stars: ✭ 125 (-65.28%)
Mutual labels:  reddit
Spacebot
An open-source, multipurpose, configurable discord bot that does it all (that's the plan, at least)
Stars: ✭ 41 (-88.61%)
Mutual labels:  discord-api
curl-worker
No description or website provided.
Stars: ✭ 42 (-88.33%)
Mutual labels:  curl
Hurricano
An amazing open-source Discord bot using MongoDB with many features such as a customizable prefix, a reaction menu, music, role requirement giveaways and much more!
Stars: ✭ 97 (-73.06%)
Mutual labels:  discord-api
OddshotConverter
Gets oddshot.tv clips posted on Reddit and converts it into YouTube videos.
Stars: ✭ 48 (-86.67%)
Mutual labels:  reddit
vitrina-legacy
A companion app for Muzei that fetches images from Reddit
Stars: ✭ 23 (-93.61%)
Mutual labels:  reddit
discord-account-generator
An hcaptcha-solving discord account generator; capable of generating unlocked discord accounts.
Stars: ✭ 61 (-83.06%)
Mutual labels:  discord-api
scripts
A collection of random scripts I coded up
Stars: ✭ 17 (-95.28%)
Mutual labels:  reddit
vosonSML
R package for collecting social media data and creating networks for analysis.
Stars: ✭ 65 (-81.94%)
Mutual labels:  reddit
Discord.CPP
Discord.CPP is a C++ library for interaction with the Discord API.
Stars: ✭ 46 (-87.22%)
Mutual labels:  discord-api

orca


Easy to reason, easy to debug, easy to use.

Join our Discord server:
Discord server

About

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:

  • Minimize the need to thoroughly document every Orca API.
  • Reduce our user's cognitive burden of having to read both Orca API documentation and supported REST API documentation.
  • The codebase becomes easier to navigate.

Orca's implementation has minimum external dependencies to make bot deployment deadly simple.

Design

  • 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.

Minimal example

#include <string.h> // strcmp()
#include <orca/discord.h>

void on_ready(struct discord *client) 
{
  const struct discord_user *bot = discord_get_self(client);
  log_info("Logged in as %s!", bot->username);
}

void on_message(struct discord *client, const struct discord_message *msg)
{
  if (strcmp(msg->content, "ping") != 0)
    return; // ignore messages that aren't 'ping'

  discord_async_next(client, NULL); // make next request non-blocking (OPTIONAL)
  struct discord_create_message_params params = { .content = "pong" };
  discord_create_message(client, msg->channel_id, &params, NULL);
}

int main(void)
{
  struct discord *client = discord_init(BOT_TOKEN);
  discord_set_on_ready(client, &on_ready);
  discord_set_on_message_create(client, &on_message);
  discord_run(client);
}

This is a minimalistic example, refer to examples/ for a better overview.

Build Instructions

On Windows

  • Install WSL2 and get either Ubuntu or Debian here.
  • Make sure you are in your Linux $HOME folder before proceeding!
  • Continue to On Linux and follow your distro's building steps.

On Linux

The only dependency is curl-7.4.1 or higher

Ubuntu and Debian

$ sudo apt install -y build-essential libcurl4-openssl-dev

Void Linux

$ sudo xbps-install -S libcurl-devel

Setting up your environment

Clone orca into your workspace

$ git clone https://github.com/cee-studio/orca.git && cd orca

Compile orca

$ make

Configuring orca

The following outlines the default fields of config.json

{
  "logging": { // logging directives
    "level": "trace",        // trace, debug, info, warn, error, fatal
    "filename": "bot.log",   // the output file
    "quiet": false,          // change to true to disable logs in console
    "overwrite": false,      // overwrite existing file with "filename"
    "use_color": true,       // log with color
    "http": {
      "enable": true,        // generate http specific logging
      "filename": "http.log" // the output file
    },
    "disable_modules": ["WEBSOCKETS", "USER_AGENT"] // disable logging for these modules
  },
  ...         // API directives (discord, slack, github, etc)
}

Test Echo-Bot

  1. Get your bot token and add it to 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.
  2. Build example executables:
    $ make examples
  3. Run Echo-Bot:
    $ cd examples && ./bot-echo

Get Echo-Bot Response

Type a message in any channel the bot is part of and the bot should send an echo response in return.

Terminate Echo-Bot

With Ctrl+c or by closing the Terminal.

Create your first bot

  • Head to my_bot/, a special folder set-up for your convenience that may be modified freely.
  • Read our guide for building your first bot.

Installing orca

Orca can be installed in case developing inside of my_bot/ doesn't suit your needs:

$ sudo make install

Included headers must be orca/ prefixed:

#include <orca/discord.h>

Standalone executable

GCC (Recommended)

$ gcc myBot.c -o myBot -pthread -ldiscord -lcurl

Clang

$ clang myBot.c -o myBot -pthread -ldiscord -lcurl

Recommended debuggers

First, make sure your executable is compiled with the -g flag to ensure human-readable debugger messages.

Valgrind

Using valgrind to check for memory leaks:

$ valgrind --leak-check=full ./myBot

For a more comprehensive guide check Valgrind's Quick Start.

GDB

Using GDB to check for runtime errors, such as segmentation faults:

$ gdb ./myBot

And then execute your bot from the gdb environment:

(gdb) run

If the program has crashed, get a backtrace of the function calls leading to it:

(gdb) bt

For a more comprehensive guide check Beej's Quick Guide to GDB

Support

Problems? Check out our Discord Server.

Links

Contributing

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!

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].