From: MatthieuCoder Date: Tue, 3 Jan 2023 10:46:43 +0000 (+0400) Subject: add readme and example files X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=ba9e5e0ace9be65c419e694487c7876bb5f88556;p=matthieu%2Fgru.git add readme and example files --- diff --git a/.gitignore b/.gitignore index b2de364..67a6e37 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ -config/ +config/* +!config/default.example.yml dist/ -bin/ +bin/* +!bin/.gitkeep node_modules/ \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..de6888e --- /dev/null +++ b/README.md @@ -0,0 +1,75 @@ +# Nova quickstart + +This is a simple example of a nov base Discord bot inspired by the discord.js structure. + +## What you'll be doing + +This repo is a simple example of a bot developped using Nova. It's a simple bot that executes `ping` (ICMP Echo) requests using slash-commands. + +> Issuing arbitrary pings is not viable for a real discord bot, this is an example. Acces to your developement bot should be kept private to avoid abuse. + + + +## Running + +### Configuring your instance + +> The nova-all-in-one we are going to use is going to search this directory for a `default.{toml,json,json5,yml,yaml}`, feel free to use the configuration language you feel confortable with. + +You need to fill the configuration file and rename it to `default.yml` in the `config/` folder. + +### Getting nova running + +Download the nova-all-in-one server and put it in `bin/nova`. +You can find the binary in the nova project releases page. + +> You can also use a full Nova instance running in `docker-compose` or an orchestrator such as [Kubernetes](https://kubernetes.io). Using a real nova instance, you'll need to store the configuration file safely depending on your orchestrator. + +The next step is starting nova: + +```bash +RUST_LOG=info ./bin/nova +``` + +### Installing npm dependencies + +Since this example use node, you need node.js installed and a package manager, we recommend *yarn* or *pnpm*. + +```bash +# Using yarn +yarn +# Using pnpm +pnpm install +# Using npm +npm install +``` + +### Registering commands + +Before starting your bot, you need to run the `register.ts` utility to register the commands wihin discord. + +> Registering commands is a one-time operation to tell discord which commands are available, you can read more about it [here](https://discord.com/developers/docs/interactions/application-commands#registering-a-command) + +```bash +# Using yarn +yarn register +# Using pnpm +pnpm run register +# Using npm +npm run register +``` + +### Starting the bot + +Finally, you can start the bot instance. + +```bash +# Using yarn +yarn start +# Using pnpm +pnpm run start +# Using npm +npm run start +``` + +**Everything should be running now!** \ No newline at end of file diff --git a/bin/.gitkeep b/bin/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/config/default.example.yml b/config/default.example.yml new file mode 100644 index 0000000..d4978c2 --- /dev/null +++ b/config/default.example.yml @@ -0,0 +1,53 @@ +gateway: + token: + intents: 3276799 + shard: 0 + shard_total: 1 + +rest: + discord: + token: + server: + port: 8090 + address: 0.0.0.0 + +webhook: + discord: + public_key: + client_id: + server: + port: 8091 + address: 0.0.0.0 + +cache: + toggles: + - channels_cache + - guilds_cache + - guild_schedules_cache + - stage_instances_cache + - integrations_cache + - members_cache + - bans_cache + - reactions_cache + - messages_cache + - threads_cache + - invites_cache + - roles_cache + - automoderation_cache + - voice_states_cache + +ratelimiter: + + +# Prometheus monitoring configuration +monitoring: + enabled: false + address: 0.0.0.0 + port: 9000 + +# Nats broker configuration +nats: + host: nats + +redis: + url: redis://redis diff --git a/imgs/nova1.png b/imgs/nova1.png new file mode 100644 index 0000000..85361d7 Binary files /dev/null and b/imgs/nova1.png differ