Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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.

Awesome Lists containing this project

README

        

kanna

# 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.