Simp-O-Matic

Dumb Discord bot in TS.
git clone git://git.knutsen.co/Simp-O-Matic
Log | Files | Refs | README | LICENSE

commit 6b2c28c58510c0d6e37bf8d268e58bee214400cd
parent 9096182e73ab8ed75b5ebcbfe784c5287bdef9a2
Author: Demonstrandum <moi@knutsen.co>
Date:   Mon,  9 Mar 2020 02:30:59 +0000

Friendship ended with `now`.

Diffstat:
M.gitignore | 1+
MREADME.md | 24+++++-------------------
Mlib/main.ts | 11-----------
Dnow.json | 23-----------------------
Mpackage.json | 4+---
Dpublic/index.html | 8--------
6 files changed, 7 insertions(+), 64 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -1,5 +1,6 @@ # Secrets! secrets.json +.env export_secrets.sh # Node / NPM / Yarn diff --git a/README.md b/README.md @@ -16,7 +16,7 @@ with GitHub rendering). ## Getting Up & Running -Make sure you have `node` (`v12.x`) and `yarn`installed +Make sure you have `node` (`v10.x`) and `yarn` installed (`npm` also possible). - Clean up from previous build/install: @@ -33,15 +33,10 @@ yarn build ``` - Run the bot locally: ```sh -yarn run -``` -- Or deploy it with `now`: -```sh -yarn deploy +yarn start ``` -In both cases (`deploy` or `start`) you'll need your secrets set up -(API keys etc.). +When starting the bot, you'll need your secrets set up (API keys etc.). ### Local Secrets @@ -56,16 +51,7 @@ export OXFORD_ID="exampleExampleExampleExample" export OXFORD_KEY="exampleExampleExampleExample" ``` -### Now Deployment Secrets - -`now` has a `secrets` functionality, which will store your secrets, and -export them as environment variables, for your `now`, you can do: +### Low on Space ```sh -now secrets add discord-bot-api-token "$BOT_API_TOKEN" -now secrets add rapid-api-key "$RAPID_API_KEY" -now secrets add discord-client-key "$CLIENT_KEY" -now secrets add discord-client-id "$CLIENT_ID" -now secrets add oxford-dictionary-id "$OXFORD_ID" -now secrets add oxford-dictionary-key "$OXFORD_KEY" +yarn --global-folder ./node_modules/ --cache-folder ./node_modules/ ``` -For some context, have a look in `./now.json`. diff --git a/lib/main.ts b/lib/main.ts @@ -312,14 +312,3 @@ SimpOMatic.start(); // Back-up the resultant CONFIG to an external file. write_file(`${process.cwd()}/export.json`, export_config(CONFIG, {})); - -// When deploying to now, we need an HTTP server, since -// now expects mainly website. -import { createServer } from 'http'; -// createServer((_req, res) => { -// res.writeHead(200, { 'Content-Type': 'text/html' }); -// res.end( -// read_file(`${process.cwd()}/public/index.html`).toString(), -// 'utf-8'); -// }).listen(3000); -createServer().listen(3000); diff --git a/now.json b/now.json @@ -1,23 +0,0 @@ -{ - "name": "simpomatic", - "version": 1, - "public": true, - "scale": { - "bru1": { - "min": 1, - "max": 1 - } - }, - "github": { - "enabled": false - }, - - "env": { - "BOT_API_TOKEN": "@discord-bot-api-token", - "RAPID_API_KEY": "@rapid-api-key", - "CLIENT_KEY": "@discord-client-key", - "CLIENT_ID": "@discord-client-id", - "OXFORD_ID": "@oxford-dictionary-id", - "OXFORD_KEY": "@oxford-dictionary-key" - } -} diff --git a/package.json b/package.json @@ -18,8 +18,7 @@ "build": "node -v && ./build.sh", "reset": "rm -rf ./build ./node_modules ./yarn.lock ./packages-lock.json", "start": "node .", - "quick": "yarn run build && yarn run start", - "deploy": "now && echo \"Remeber to scale: `now scale [url] 1 1`\"" + "quick": "yarn run build && yarn run start" }, "homepage": "https://github.com/Demonstrandum/simpomatic", "repository": { @@ -30,7 +29,6 @@ "url": "https://github.com/Demonstrandum/simpomatic/issues" }, "dependencies": { - "@discordjs/uws": "^10.149.0", "@typeit/discord": "^1.0.3", "@types/node": "^13.9.0", "@types/ws": "^7.2.2", diff --git a/public/index.html b/public/index.html @@ -1,8 +0,0 @@ -<html> - <head> - <title>Simp'O'Matic</title> - </head> - <body> - tf you doing here, this is a discord bot... - </body> -</html>