{"id":17169342,"url":"https://github.com/roughsketch/libdiscord_old","last_synced_at":"2026-05-17T09:37:47.939Z","repository":{"id":66271597,"uuid":"82932895","full_name":"Roughsketch/libdiscord_old","owner":"Roughsketch","description":"C++ library for Discord","archived":false,"fork":false,"pushed_at":"2017-03-07T03:43:14.000Z","size":451,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-10-24T06:45:57.149Z","etag":null,"topics":["async","cpp-library","cpp14","discord","websockets"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Roughsketch.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-23T14:03:36.000Z","updated_at":"2017-03-19T21:29:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"1f3a62fd-7746-4d85-a55a-ad8dfb9ab29f","html_url":"https://github.com/Roughsketch/libdiscord_old","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Roughsketch/libdiscord_old","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Roughsketch%2Flibdiscord_old","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Roughsketch%2Flibdiscord_old/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Roughsketch%2Flibdiscord_old/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Roughsketch%2Flibdiscord_old/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Roughsketch","download_url":"https://codeload.github.com/Roughsketch/libdiscord_old/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Roughsketch%2Flibdiscord_old/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33133922,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-17T09:28:26.183Z","status":"ssl_error","status_checked_at":"2026-05-17T09:27:52.702Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["async","cpp-library","cpp14","discord","websockets"],"created_at":"2024-10-14T23:25:53.653Z","updated_at":"2026-05-17T09:37:47.920Z","avatar_url":"https://github.com/Roughsketch.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"- [Getting Started](#getting-started)\n  - [Compiling libdiscord for Windows](#compiling-libdiscord-for-windows)\n  - [Compiling a bot on Windows](#compiling-a-bot-on-windows)\n  - [Compiling libdiscord for Linux](#compiling-libdiscord-for-linux)\n  - [Compiling a bot on Linux](#compiling-a-bot-on-linux)\n- [Examples](#examples)\n  - [Handling OnMessage](#handling-onmessage)\n  - [Creating a Command](#creating-a-command)\n  - [Respond as a Stream](#respond-as-a-stream)\n  \n## Getting Started\n\n### Compiling libdiscord for Windows\n\nYou should be able to simply download this git repository and open up the .sln file and build it after installing some dependencies. \n\nThe solution was made in Visual Studio 2015 and has the following dependencies:\n\n- **CPPRestSDK** You can install this as a Nuget package.\n- **ZLib** You can install this as a Nuget package. \n\nAfter installing these dependencies you should be able to compile the libdiscord project.\n\n### Compiling a Bot on Windows\nTo compile a bot on Windows you must have libdiscord.lib and the libdiscord include directory in your path. If using Visual Studio, simply add them to your project settings. After your project is set up, you must include the `discord.h` header file to access the library.\n\n### Compiling libdiscord for Linux\nThe git project has a very simple makefile, so you should be able to just use make in the root directory. However, you will need to have CPPRestSDK and its dependencies installed. Visit [this link](https://github.com/Microsoft/cpprestsdk/wiki/How-to-build-for-Linux) to learn how to install it.\n\nHere is a list of all the libraries you must have installed:\n\n- boost_system\n- cpprest\n- crypto\n- pthread\n- ssl\n- z\n\nThe command that you should run is `make \u0026\u0026 sudo make install`. This will build libdiscord.so into the `lib` directory (Create this if it's missing), and the install command will place the resulting library into `/usr/lib/libdiscord.so`. From there, your programs should be able to compile using this library.\n\n### Compiling a Bot on Linux\nThis is a bit more involved than Windows simply because I don't know if you can combine shared libraries easily. Assuming you have a project with a single `main.cpp` file, you would compile it like so:\n\n```\ng++ main.cpp -Ilibdiscord/include -ldiscord -lboost_system -lcrypto -lssl -lcpprest -lz -lpthread -std=c++14 -o output_file\n```\n\nIn here, you should be using the `-I` flag to point to the libdiscord includes. After that, you must include `-ldiscord` for this library, and then link it against all its dependencies as well. This is a bit more than I would like for a simple program, so I'll try to look into simplifying it later.\n\n## Examples\n### Handling OnMessage\nThe following bot will respond to any `Ping!` with a `Pong!`\n\n```cpp\n#include \u003cdiscord.h\u003e\n\n//  Use this to avoid using Discord:: everywhere\n//  using namespace Discord;\n\n//  Or use this to shorten it to just ds::\n//  namespace ds = Discord;\n\nint main() {\n  std::string token = \"YOUR_TOKEN\";\n  auto bot = Discord::Bot::create(token);\n  \n  bot-\u003eon_message([](Discord::MessageEvent event) {\n    if (event.content() == \"Ping!\") {\n      event.respond(\"Pong!\");\n    }\n  });\n  \n  bot-\u003erun();\n}\n```\n\n### Creating a Command\nCreating a command is just like handing `on_message`, except it takes a command name parameter.\n\n```cpp\n#include \u003cdiscord.h\u003e\n\nint main() {\n  std::string token = \"YOUR_TOKEN\";\n  auto bot = Discord::Bot::create(token, \"!\"); // ! is the prefix\n  \n  //  This command will respond \"Pong!\" to any \"!ping\"\n  bot-\u003eadd_command(\"ping\", [](Discord::MessageEvent event) {\n    event.respond(\"Pong!\");\n  });\n  \n  bot-\u003erun();\n}\n```\n\n### Respond as a Stream\nYou may also respond to events similar to how you would use `std::cout`. An example out put of this command is `Hello Amoo#2681!`.\n\n```cpp\nbot-\u003eadd_command(\"hello\", [](Discord::MessageEvent event) {\n  event \u003c\u003c \"Hello \" \u003c\u003c event.author()-\u003edistinct() \u003c\u003c \"!\";\n});\n```\n\nYou may also queue up several different responses and they will be combined into one single response. This example is another way to write the above.\n\n```cpp\nbot-\u003eadd_command(\"hello\", [](Discord::MessageEvent event) {\n  event \u003c\u003c \"Hello \";\n  event \u003c\u003c event.author()-\u003edistinct();\n  event \u003c\u003c \"!\";\n  //  Message is sent after lambda is finished.\n});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froughsketch%2Flibdiscord_old","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Froughsketch%2Flibdiscord_old","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Froughsketch%2Flibdiscord_old/lists"}