mirror of
https://github.com/discordeno/discordeno.git
synced 2026-05-30 07:20:08 +00:00
* Update docusaurus typescript setup for v3 And fix lint-staged and eslint * Enable automatic JSX runtime * Remove babel config and dependencies * update yarn.lock * add typecheck to site workflow * update typedoc config * downgrade docusaurus packages * Update site.yml * Type context and options in webpack-docusaurus-plugin.ts * Update env tips and add minimal examples for node and bun And update the one from deno that was really out of date --------- Co-authored-by: Matt Hatcher <3768988+MatthewSH@users.noreply.github.com>
1.2 KiB
1.2 KiB
sidebar_position, sidebar_label
| sidebar_position | sidebar_label |
|---|---|
| 2 | Using with Node.js |
Using with Node.js
Discordeno supports Node.js by installing the @discordeno/bot package
Pre-Requirements
Before, going forward, please make sure to have finished everything on this list.
- Create an application and get the bot token. Create Application Guide
- Add your bot to a server you own. Invite Bot Guide
- Install Discordeno. Installation Guide
- Setup environment variables. Environment Variables Guide
After you installed the @discordeno/bot package with npm, yarn, pnpm or bun you can start using it.
This is how you can use it to create a bot that logs into discord:
import dotenv from 'dotenv'
import { createBot } from '@discordeno/bot'
dotenv.config()
const bot = createBot({
token: process.env.token,
events: {
ready: ({ shardId }) => console.log(`Shard ${shardId} ready`),
},
})
await bot.start()
:::note
For this example we will be using the env setup with dotenv
:::
You are free to expand from this point with whatever code you want. Happy coding!