|
14 | 14 |
|
15 | 15 | It handles various interactions, adds a layer of wrapper over raw interactions with rich utility methods, and organizes them into modular routes, making your bot's code cleaner, easier to understand, and easier to maintain. It works seamlessly in both serverless and persistent server environments. |
16 | 16 |
|
17 | | -📄 **Documentation:** [https://discordhttps.js.org/](https://discordhttps.js.org/) |
| 17 | +📄 **Documentation:** [https://discordhttps.js.org](https://discordhttps.js.org) |
18 | 18 |
|
19 | 19 | Need help? Join us on discord [https://discord.gg/pSgfJ4K5ej](https://discord.gg/pSgfJ4K5ej) |
20 | 20 |
|
| 21 | +## Initilize discord.https |
| 22 | + |
| 23 | +You can initialize a project via CLI: |
| 24 | + |
| 25 | +```bash |
| 26 | +npx create-discord-https@latest |
| 27 | +``` |
| 28 | + |
| 29 | +Or, manually: |
| 30 | + |
21 | 31 | ```js |
22 | | -import Client, { InteractionResponseType } from "discord.https"; |
| 32 | +import Client from "discord.https"; |
23 | 33 | import NodeAdapter from "@discordhttps/nodejs-adapter"; |
24 | 34 |
|
25 | 35 | const client = new Client({ |
@@ -52,39 +62,56 @@ await client.listen("interactions", 3000, () => { |
52 | 62 |
|
53 | 63 | ## Examples |
54 | 64 |
|
55 | | -> Examples are outdated. You are no longer required to handle the raw response. The core is still there, and you can use these examples as a reference. |
56 | | -
|
57 | | -Deprecate warning, this example can be serve as a basic idea, but it has been changed quite a lot since, with utility functions. |
| 65 | +Note: You can get this reference implementation directly via CLI, see Initializing Your Project → Using CLI. |
58 | 66 |
|
59 | 67 | **You can view example/reference implementations here:** |
60 | 68 |
|
61 | | -- Nodejs Runtime: [https://github.com/discordhttps/nodejs-example](https://github.com/discordhttps/nodejs-example) |
62 | | -- V8 isolates runtime(Cloudflare Workers): [https://github.com/discordhttps/cloudflare-example](https://github.com/discordhttps/cloudflare-example) |
| 69 | +- Nodejs: [https://github.com/discordhttps/create-discord-https/tree/main/templates/node](https://github.com/discordhttps/create-discord-https/tree/main/templates/node) |
| 70 | +- V8 isolates runtime(Cloudflare Workers): [https://github.com/discordhttps/create-discord-https/tree/main/templates/cloudflare](https://github.com/discordhttps/create-discord-https/tree/main/templates/cloudflare) |
| 71 | +- Vercel Serverless: [https://github.com/discordhttps/create-discord-https/tree/main/templates/vercel](https://github.com/discordhttps/create-discord-https/tree/main/templates/vercel) |
| 72 | + |
| 73 | +## Initializing Your Project |
| 74 | + |
| 75 | +### Using CLI (Recommended) |
63 | 76 |
|
64 | | -## Installation |
| 77 | +```bash |
| 78 | +npx create-discord-https@latest |
| 79 | +``` |
| 80 | + |
| 81 | +Follow the prompts to set up your project. |
| 82 | + |
| 83 | +### Manual Installation |
| 84 | + |
| 85 | +Install discord.https along with the adapter for your server environment. |
65 | 86 |
|
66 | | -### Node.js |
| 87 | +#### Node.js |
67 | 88 |
|
68 | 89 | ``` |
69 | 90 | npm install discord.https @discordhttps/nodejs-adapter |
70 | 91 | ``` |
71 | 92 |
|
72 | | -### Cloudflare |
| 93 | +#### Cloudflare |
73 | 94 |
|
74 | 95 | ``` |
75 | 96 | npm install discord.https @discordhttps/cloudflare-adapter |
76 | 97 | ``` |
77 | 98 |
|
| 99 | +#### Vercel |
| 100 | + |
| 101 | +``` |
| 102 | +npm install discord.https @discordhttps/vercel-adapter |
| 103 | +``` |
| 104 | + |
78 | 105 | ## Documentation |
79 | 106 |
|
80 | | -- **Discord.https Docs:** [https://discordhttps.js.org/](https://discordhttps.js.org/) |
| 107 | +- **Discord.https Docs:** [https://discordhttps.js.org](https://discordhttps.js.org) |
81 | 108 | - **Discord Interaction Docs:** [Responding to an Interaction](https://discord.com/developers/docs/interactions/receiving-and-responding#responding-to-an-interaction) |
82 | 109 |
|
83 | 110 | ## Todo for v4 |
84 | 111 |
|
85 | | -- [ ] Build a simplified `npx create-app` command |
86 | 112 | - [ ] Implement tests |
87 | 113 | - [ ] Build channel, guild, etc wrapper |
| 114 | +- [x] ~~Build a simplified `npx create-app` command~~ |
88 | 115 | - [x] ~~Build interaction wrapper~~ |
89 | 116 | - [x] ~~HTTP adapters to support most hosting environments~~. Currently implemented: Node.js adapter for [Node.js runtime](https://github.com/discord-http/nodejs-adapter) and [Cloudflare adapter for V8 isolates runtime](https://github.com/discord-http/cloudflare-adapter) |
90 | 117 | - [x] Examples(currently outdated, requires update) |
0 commit comments