{"id":20985793,"url":"https://github.com/cordeno/cordeno","last_synced_at":"2025-05-14T17:32:18.097Z","repository":{"id":44657856,"uuid":"266057588","full_name":"cordeno/cordeno","owner":"cordeno","description":"🦕 A Discord API wrapper for developing discord bots using the Deno runtime.","archived":false,"fork":false,"pushed_at":"2020-12-14T18:29:26.000Z","size":208,"stargazers_count":14,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-10-28T12:15:27.675Z","etag":null,"topics":["deno","deno-runtime","discord","discord-api","typescript"],"latest_commit_sha":null,"homepage":"https://deno.land/x/cordeno","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cordeno.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-05-22T08:22:12.000Z","updated_at":"2024-05-01T18:43:48.000Z","dependencies_parsed_at":"2022-09-26T21:50:52.351Z","dependency_job_id":null,"html_url":"https://github.com/cordeno/cordeno","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cordeno%2Fcordeno","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cordeno%2Fcordeno/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cordeno%2Fcordeno/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cordeno%2Fcordeno/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cordeno","download_url":"https://codeload.github.com/cordeno/cordeno/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225191571,"owners_count":17435567,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["deno","deno-runtime","discord","discord-api","typescript"],"created_at":"2024-11-19T06:10:51.086Z","updated_at":"2024-11-19T06:10:51.958Z","avatar_url":"https://github.com/cordeno.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Cordeno](assets/cordeno-200.gif)\n# Cordeno\n[![deno doc](https://img.shields.io/badge/deno-doc-blue?style=flat)](https://doc.deno.land/https/deno.land/x/cordeno@v0.3.5/mod.ts)\n[![GitHub stars](https://img.shields.io/github/stars/cordeno/cordeno?style=flat)](https://github.com/cordeno/cordeno)\n[![Discord](https://img.shields.io/discord/713653280638631976?color=%237289DA\u0026label=discord\u0026style=flat)](https://discord.gg/WT2g6Mn)\n[![GitHub last commit](https://img.shields.io/github/last-commit/cordeno/cordeno?label=last%20stable%20commit\u0026style=flat)](https://github.com/cordeno/cordeno/commits/)\n[![GitHub last commit dev](https://img.shields.io/github/last-commit/cordeno/cordeno/dev2?label=last%20dev%20commit\u0026style=flat)](https://github.com/cordeno/cordeno/commits/dev2)  \nAn simplistic, event loop driven [Discord API](https://discord.com/developers/docs/reference) library for building powerful bots.  \nPowered by the [Deno runtime](https://deno.land/).  \nInspired by [Dinocord](https://github.com/sunsetkookaburra/dinocord).\n\n# Development progress\nCordeno is still in its **early stages of development**, and is not production ready. Many cores features of the Discord API is still missing, and has yet to be implemented.\nBreaking changes may occur at any time without prior warning.  \nCurrent master branch version: `0.3.5`  \nFind `dev` branch [here!](https://github.com/cordeno/cordeno/tree/dev2)  \nAll current events can be found in the example below, but not every method is listed as of this moment. Take a look at the [documentation](https://doc.deno.land/https/deno.land/x/cordeno@v0.3.5/mod.ts)\n\n# Example:\nindex.ts\n```ts\nimport {\n  Client,\n  MESSAGE_CREATE,\n  READY,\n  RATELIMIT,\n  HEARTBEAT,\n  RESUMED,\n  INVALID_SESSION,\n  ev,\n} from \"https://deno.land/x/cordeno@v0.3.5/mod.ts\";\n\nconst client = new Client({\n  token: \"YOUR TOKEN HERE\",\n});\n\nconsole.log(`Running cordeno v${client.version}`);\n\nfor await (const ctx of client) {\n  switch (ctx.event) {\n    case ev.Ready: {\n      const ready: READY = ctx;\n\n      console.log(\"Cordeno is now ready!\");\n      console.log(\"Discord websocket API version is \" + ready.gatewayVersion);\n\n      // Sets client presence\n      client.user.setPresence({\n        status: \"online\",\n        game: {\n          name: \"Taking over the world!\",\n          type: \"playing\",\n        },\n      });\n      break;\n    }\n    case ev.Resumed: {\n      const resumed: RESUMED = ctx;\n      if (resumed.reconnectRequested) {\n        console.log(\"Discord API requested a reconnect.\");\n        break;\n      }\n      console.log(`Resumed at: ${resumed.resumeTime}`);\n      break;\n    }\n    case ev.InvalidSession: {\n      const session: INVALID_SESSION = ctx;\n      console.log(\n        `An invalid session occured. Can resume from previous state?: ${session.canResume}`,\n      );\n      break;\n    }\n    case ev.Ratelimit: {\n      const ratelimit: RATELIMIT = ctx;\n      console.log(`A rate limit was hit for the route: ${ratelimit.route}`);\n      // deno-fmt-ignore\n      console.log(`The ratelimit will reset in ${Math.round(ratelimit.resetIn / 1000 * 10) / 10}s`);\n      break;\n    }\n\n    case ev.Heartbeat: {\n      const heartbeat: HEARTBEAT = ctx;\n      // deno-fmt-ignore\n      console.log(\n        \"Heartbeat recieved: \\n\" +\n        `=\u003etotal: ${heartbeat.total}\\n=\u003erate: ${Math.round(heartbeat.rate / 1000 * 10) / 10}s`\n        );\n      break;\n    }\n    case ev.Message: {\n      const msg: MESSAGE_CREATE = ctx;\n      if (msg.author.id !== client.user.id) {\n        let prefix = \"!\";\n        let args: Array\u003cstring\u003e = msg.content\n          .slice(Object.keys(prefix).length)\n          .trim()\n          .split(/ +/g);\n        let cmd = args?.shift()?.toLowerCase();\n\n        switch (cmd) {\n          case \"ping\": {\n            await msg.reply(`Pong!`);\n            await msg.reply(`Message author: ${msg.author.username}`);\n            await msg.reply(`User created at: ${msg.author.createdOn}`);\n            await msg.reply(`Created at: ${msg.createdAt}`);\n            await msg.reply(`Client name: ${client.user.name}`);\n            console.log(await msg.guild.id);\n            break;\n          }\n          case \"cordeno\": {\n            await msg.reply(`Cordeno v${client.version}`, {\n              mention: true,\n            });\n            break;\n          }\n          case \"guildinfo\": {\n            await msg.reply(`\u003e The guild owner is \u003c@${msg.guild.ownerID}\u003e`);\n            await msg.reply(\n              `\\`\\`\\`Guild name: ${msg.guild.name}\\nGuild ID: ${msg.guild.id}\\nThe Guild was created on ${msg.guild.createdOn}\\`\\`\\``,\n            );\n            break;\n          }\n        }\n      }\n      break;\n    }\n  }\n}\n```\nAfter creating your file and pasting the above code, add your token and run\n```shell\ndeno run --allow-net --reload index.ts\n```\nThe `--reload` tag reinstalls all the dependencies in your project.\nYou don't have to include `--reload` every run, but I recommend including it as an argument at least once a day to keep cordeno up to date.\n\n# Contributing\n[![GitHub contributors](https://img.shields.io/github/contributors/cordeno/cordeno?style=flat)](https://github.com/cordeno/cordeno/graphs/contributors)  \nWant to contribute? Follow the [Contributing Guide](https://github.com/cordeno/cordeno/blob/master/CONTRIBUTING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcordeno%2Fcordeno","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcordeno%2Fcordeno","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcordeno%2Fcordeno/lists"}