https://github.com/jeremytubongbanua/countwatcher
Discord bot personal project for watching counting channel
https://github.com/jeremytubongbanua/countwatcher
discordjs googlecloud nodejs typescript
Last synced: 3 months ago
JSON representation
Discord bot personal project for watching counting channel
- Host: GitHub
- URL: https://github.com/jeremytubongbanua/countwatcher
- Owner: JeremyTubongbanua
- Created: 2021-12-03T18:56:12.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-12-06T20:15:49.000Z (over 3 years ago)
- Last Synced: 2025-01-19T02:48:21.626Z (5 months ago)
- Topics: discordjs, googlecloud, nodejs, typescript
- Language: TypeScript
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
TypeScript commands
```
- tsc - compile everything to .js
- tsc src/index.ts - compile index.ts to .js
- tsc -w - compile watch mode
- node out/index.js - run the project
```tsconfig.json
```
- outDir: "out", - compile directory
- "resolveJsonModule": true", - for importing jsons
Typescript 2.9.0 has a bug with this JSON feature, it was fixed with 2.9.2
- "esModuleInterop": true - for importing jsons
The esModuleInterop is only necessary for the default import of the colorsJson. If you leave it set to false then you have to import it with import * as colorsJson from '../colors.json'
Note: Option "resolveJsonModule" cannot be specified without "node" module resolution strategy, so you also need to put "moduleResolution": "node" into your tsconfig.json. It also comes with the downside, that the *.json files you want to import need to be inside of "rootDir".
Source: https://stackoverflow.com/questions/49996456/importing-json-file-in-typescript
```Node Modules:
- `npm install discord.js`
Big Notes:
- For OAUTH2 URL generation, make sure to check "bot" and "applications.commands" in the scopes tab.
- See `command.ts` for an interface example.Google Cloud:
- Compute Engine > VM instances > Create new Instance
- Use lowest CPU
- Keep everything default
- \*maybe enble HTTPS firewall checkboxes (2)
- `sudo apt install npm` 1. install node package manager
- `sudo apt install git` 2. install git
- `python3 --version` 3. check python version
- `npm --version` 4. check npm version
- `git --version` 5. check git version
- `sudo apt -y update && sudo apt -y upgrade` 6. Get Node 17
- `curl -sL https://deb.nodesource.com/setup_17.x | sudo bash -`
- `sudo apt-get install -y nodejs`
- `node -v`7. Check node version
- `git clone ` 8. Clone git hub repo OR
- `gcloud init` 9. Initialize google cloud, login, enter project details, etc. (only needed if using buckets)
- `sudo nano out/index.js` - edit out/index.js and insert token (Ctrl X to exit and save)
- `node out/index.js` to run
- `nohup node out/index.js &>> activity.log &` - NO hang up command, runs bot 24/7 without SSH window open, then put terminal logs in activity.logtodo automatic delete-
todo leaderboard
todo count command