From 32ca0eda341bc31241a20eb8e67cdc0108ef2849 Mon Sep 17 00:00:00 2001 From: Kurt Hutten Date: Sun, 23 Jan 2022 12:55:57 +1100 Subject: [PATCH] Remove discord.js dependency. --- CONTRIBUTING.md | 8 ++--- app/api/package.json | 1 - app/api/src/lib/discord.ts | 3 +- app/yarn.lock | 74 ++------------------------------------ 4 files changed, 8 insertions(+), 78 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 9edf3a5..3c4223a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -32,7 +32,7 @@ Install dependencies yarn install ``` -Setting up the db, you'll need to have a postgres installed locally, you can [follow this guide](https://redwoodjs.com/docs/local-postgres-setup). +Setting up the db, you'll need to have a postgres installed locally, you can [follow this guide](https://redwoodjs.com/docs/local-postgres-setup). Run the following (Note: these commands require the `DATABASE_URL` env variable to be set. if you see no result when you run `echo $DATABASE_URL`, you can set it with a command like `export DATABASE_URL=postgres://postgres:somepassword@localhost`) ``` terminal @@ -61,7 +61,7 @@ localAdmin@kurthutten.com: `abc123` ### Discord bot setup -To set up the discord bot to notify when users publish new content (see also [the discord JS tutorial](https://discordjs.guide/preparations/setting-up-a-bot-application.html)): +To set up the discord bot to notify when users publish new content, we're using the [REST](https://discord.com/developers/docs/resources/channel#message-object) API directly, used more as a notification service rather than a bot since we are not listening to messages in the chat. 1. If you're setting up the bot in a dev environment, create a new discord server (the "plus" button on the left when logged into the Discord webpage). Make note of the name of the project. 2. With [developer mode turned on](https://www.howtogeek.com/714348/how-to-enable-or-disable-developer-mode-on-discord/), right click the channel you wish the bot to announce on and select "Copy ID". Add this to `.env.defaults` as `DISCORD_CHANNEL_ID`. @@ -75,9 +75,9 @@ When you next start CADHub, you should see in the logs `Discord: logged in as