{"id":20643508,"url":"https://github.com/dxing97/libdiscord-0.2","last_synced_at":"2026-04-21T14:33:47.908Z","repository":{"id":239806434,"uuid":"98740281","full_name":"dxing97/libdiscord-0.2","owner":"dxing97","description":"The second bot based on libdiscord, now depreciated","archived":false,"fork":false,"pushed_at":"2017-11-12T03:45:46.000Z","size":41,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-09T14:34:22.091Z","etag":null,"topics":["c","discord"],"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/dxing97.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-07-29T15:10:54.000Z","updated_at":"2017-12-19T01:55:02.000Z","dependencies_parsed_at":"2024-05-15T14:32:35.361Z","dependency_job_id":"d0edc435-4636-48de-84cd-17ee028c101f","html_url":"https://github.com/dxing97/libdiscord-0.2","commit_stats":null,"previous_names":["dxing97/libdiscord-0.2"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dxing97/libdiscord-0.2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dxing97%2Flibdiscord-0.2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dxing97%2Flibdiscord-0.2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dxing97%2Flibdiscord-0.2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dxing97%2Flibdiscord-0.2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dxing97","download_url":"https://codeload.github.com/dxing97/libdiscord-0.2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dxing97%2Flibdiscord-0.2/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32095929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T11:25:29.218Z","status":"ssl_error","status_checked_at":"2026-04-21T11:25:28.499Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5: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":["c","discord"],"created_at":"2024-11-16T16:13:00.748Z","updated_at":"2026-04-21T14:33:47.889Z","avatar_url":"https://github.com/dxing97.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"#THIS CODE HAS REACHED PEAK SPAGHETTI\nThis repo won't be updated for the forseeable future. Check out the \nlatest iteration of libdiscord for more.\n\n# Bot 2\nThis bot will connect to the Discord gateway, remain connected, \n    and have it's current game set to the name of this library. (libdiscord v0.1.0 or whatever is in CMakeLists.txt)\nIt will then respond to any messages in channel #singular-one with a magic string (respond) with the \ncurrent time and library information.\n\nNote that is bot is only compatible with Discord API v6.\n## scopes and stuff\n\n### library-defined information:\n- library version and name (libdiscord v0.1.0)\n  - from CMake\n- API details (Discord API v6) such as what port to use, endpoints, base URLs, etc\n     \n\n### user defined information:\n- config file location (optional)\n- bot token (required, read from config file/command line option)\n\n### Discord defined information\n(parameters queried/recieved from discord)\n- URI(s) for gateways\n- heartbeat intervals\n\n## how this bot should work\n- get command line options using `getopt`\n- \n- read config file from specified file location (if not specified, will assume a default location)\n- use libconfig to read config file\n- initialize ld_sessiondata for session specific parameters\n    - import data from ld_configdata\n    - check validity of the bot token here\n        - intialize some rate limit parameters as well \n    - initialize the HTTP send queue\n    - initialize the websocket send queue\n    - if bot token is invalid, kill the bot (~~maybe ask the user to input a new token?~~ notify the user that the bot \n    token is invalid)\n    - if _ANYTHING_ is bad/invalid/not what we expected, kill the bot (with appropriate error message)\n- create the websocket connection\n    - if we can't connect to the gateway, kill the bot (after some error messages)\n    - receive the HELLO payload\n    - send identify payload\n        - if can't identify (i.e. Discord closes the websocket), then let the user decide \n        (why would Discord not accept an identify from a valid bot token?)\n    - begin heartbeating, and storing (SQL?)/ignoring recieved payloads\n    \n## configdata\nstruct containing all the possible fields in the config file\nmemset this to 0 before using\n- bot_token (optional, if it's not here then it MUST be in the command line args. Can't Discord without a ticket.)\n- config_path - path to the config file. \n    - if NULL, it'll look in the default location: current directory, bot.cfg (./bot.cfg)\n- more later maybe\n\n# structs \n## ratelimits\nthere is a WSS and a HTTP rate limit.\n\n\n## sessiondata\nparameters that stay (more or less) constant or persist throughout the lifetime of the bot\n- bot token (user specified)\n- shard number (Discord specified)\n- heartbeat interval (Discord specified)\n- websocket gateway URI (Discord specified)\n- websocket connection state (library determined)\n    - unconnected (start here)\n    - connecting\n    - connected \n        - not identified\n        - identified\n    - disconnected (something went wrong, there could be multiple reasons)\n    - resuming (resuming and connecting are similar but different)\n- last recieved sequence number (dispatch payloads)\n    - starts at 0 (haven't recieved a dispatch yet) and increments up with every dispatch (theoretically)\n    - determined by DISPATCHES, not the library (don't just increment up)\n- pointer to the lws wsi for our current lws connection\n- rate limit data\n   \n# Code Snippets\nSending a HTTP GET request for a bot's user informations:\n\n`\n    struct _u_request *req;\n    struct _u_response rep;\n    ulfius_init_request(req);\n    ulfius_init_response(\u0026rep);\n    req = ld_http_generate_request_string(sd, LD_HTTP_GET, \"/users/@me\", NULL);\n    ulfius_send_http_request(req, \u0026rep);\n    ld_http_print_response(sd, \u0026rep);\n`","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdxing97%2Flibdiscord-0.2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdxing97%2Flibdiscord-0.2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdxing97%2Flibdiscord-0.2/lists"}