Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mirabellierr/bun-discord-bot
An interaction Discord bot written in JS and TS using Bun runtime environment. Contains simple get avatar and get user info commands. Starting a bot only takes 0.02 - 0.05 ms.
https://github.com/mirabellierr/bun-discord-bot
bunjs discord-bot
Last synced: about 9 hours ago
JSON representation
An interaction Discord bot written in JS and TS using Bun runtime environment. Contains simple get avatar and get user info commands. Starting a bot only takes 0.02 - 0.05 ms.
- Host: GitHub
- URL: https://github.com/mirabellierr/bun-discord-bot
- Owner: MiraBellierr
- Created: 2022-07-09T14:27:33.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2022-07-25T06:40:28.000Z (over 2 years ago)
- Last Synced: 2024-11-07T10:03:12.853Z (about 9 hours ago)
- Topics: bunjs, discord-bot
- Language: TypeScript
- Homepage:
- Size: 37.1 KB
- Stars: 15
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Bun Discord Bot
An interaction Discord bot written in JS and TS using Bun runtime environment. Contains simple get avatar and get user info commands. Starting up the bot only takes `0.02-0.05 ms`.
## This bot is created with Bun runtime
Using [Bun runtime](https://bun.sh). Please visit their website on how to setup Bun runtime.
## Getting Started
### Cloning the repo
```sh
git clone https://github.com/MiraBellierr/bun-discord-bot
```### Development
To run this locally, rename `.env.example` to `.env` and fill in the variables, then you can run `bun run.js` to start a local dev environment and use something like ngrok/cloudflare to tunnel it to a URL.
### Using ngrok
A way to expose a localhost port to a URL is by using ngrok. [download](https://ngrok.com/download)
First, download and install ngrok, then type `ngrok http 1337` in a new terminal. This will create a https://\*.ngrok.io URL.
To instruct discord to use your server for all user-created interactions, you must:
- Go to to [Discord Developers Portal Applications Page](https://discord.com/developers/applications).
- Select / Create a new application. On the application's page, fill the "Interactions endpoint URL" input with the https://\*.ngrok.io/interactions url.
- Invite your application to your server using this URL: `https://discord.com/oauth2/authorize?client_id=[client-id]&scope=applications.commands`
- You're ready to go!Be aware that the ngrok URL expires after 2 hours, you'll have to restart the ngrok command after this delay.