Files
discordeno/template/bigbot/README.md
Reboot-Codes 0986fa9704 More BigBot Fixes (#2233)
* Add `.DS_Store` to `.gitignore`

* Format and improve DX.

* Add extra logging and fix gateway workers.

* Deno fmt.

* Be more explicit in `.env.example`.

* Add a `watch-bot` task and format.

* Deno FMT

* Deno FMT (all `template/bigbot` files)

Co-authored-by: ITOH <to@itoh.at>
2022-05-25 22:33:49 +02:00

79 lines
3.9 KiB
Markdown

# Discordeno Big Bot Template
Support: <https://discord.gg/ddeno>
This template is designed for bots that aim or are already in millions of Discord servers.
## Setup
- Clone this repository can move this directory into your desired project location.
- Move all files from the `bigbot` folder to the root of the project.
- You may encounter an issue with .vscode but force move the files to the root of the project. We have setup special
import maps in this template that should override the general .vscode folder already in the root folder.
- Rename the `.env.example` file to `.env`
- Fill out the `.env` file
- Go to `configs.ts` file and remove all the intents you don't want in your bot.
## Usage
> Note: Please install at least `deno@^1.22` on your system. (This is due to the requirement of the `Deno` namespace in
> workers for the `gateway` process.)
- Always run the `rest` process first with `deno task rest`.
- Start the `bot` process next with `deno task bot`. (If you are developing a bot, use `deno task watch-bot` instead to
auto reload any changes. This won't restart any other processes, just your bot.)
- Lastly, start the `gateway` process with `deno task gateway`.
> Important: The `gateway` process and `rest` are designed not to be shut off. So once those are on, the only thing you
> should be doing is restarting your `bot` process. This saves API requests
## Details
### Translating Application Commands
The template supports translations for application commands. This is possible using guild commands. If you use global
commands, translations will not work and will default to english.
If you prefer a different default(not english), please use the Find And Replace to change the `'english'` everywhere
necessary.
#### Autocomplete & Type Checking
One cool thing about the translations is that you will get autocomplete and type checking built in for all the keys.
This will ensure you do not miss a key to be translated. It will also make it easier to code by providing the
autocomplete functionality.
### Updating Application Commands
The template is designed in a way that you will no longer need to worry about updating or maintaing your commands.
- Global Commands: For simplicity you can add a line in mod.ts to update them globally. This generally takes 1 call and
isn't a deal breaker.
- `/update global` is also available on your development server, to trigger manually.
- Guild Commands: This is a bit more complicated. By default, our system will update guild commands on demand! Instead
of making a million requests for all your servers, we will update them as needed.
**Guild Commands Kwik & Command Versioning**
For Global Commands you can make 1 request to api to update all commands on restart. Its not a big deal. But with Guild
commands essentially you need to make a request per guild. This can get spammy. That would be crazy. To solve this we
created the concept of `commandVersions`. This basically will decide whether or not guild commands should be updated.
Kwik is a file based database I used in order to make this setup easy and allow any dev using this template to use a
database of their choice for their bot. I do not recommend using Kwik as your database. Please add a full database of
your choice for your bot. You can even replace Kwik should you choose in the database folder.
Process:
1. You update your command options/args or create new commands etc...
2. Increment the `CURRENT_SLASH_COMMAND_VERSION` in `src/database/commandVersion.ts`
- I recommend moving this into your database so you can build a dev command or eval and update this on the fly as you
wish.
3. Now whenever a guild emits any event, this will make sure to update the guild commands if necessary. If it already
has the latest commands, it will just ignore. If it was never updated or is using an outdated version, it will update
it.
Aside from the automated system, there is also the option of `/update guild id` to update a guild manually.