Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: version 6 #3

Merged
merged 46 commits into from
Nov 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
1ce1341
feat: init web and db
leomotors Oct 18, 2023
28bdc13
feat!: node 20
leomotors Oct 19, 2023
a61982a
feat: basic webhook
leomotors Oct 19, 2023
09a9143
feat: auth done
leomotors Oct 19, 2023
a23168f
chore: update env var name
leomotors Oct 21, 2023
c7479c4
chore: update tsconfig
leomotors Oct 21, 2023
efacf58
favicon and og image
leomotors Oct 21, 2023
60c4383
restructure routes
leomotors Oct 21, 2023
740b160
add sourceEn and sourceJa field
leomotors Oct 21, 2023
29d5d8b
feat: home page done
leomotors Oct 22, 2023
68a65e4
enhance login page
leomotors Oct 22, 2023
4a9b146
chore(web): format
leomotors Oct 22, 2023
b6e472c
encodeuricomponent instead
leomotors Oct 22, 2023
5e3c1f6
home page done
leomotors Oct 22, 2023
fb266e1
basic admin page and style more on phone
leomotors Oct 22, 2023
fe287dd
feat: SUPERIDOL role
leomotors Oct 22, 2023
48cb974
chore: deps and fix ts error
leomotors Oct 22, 2023
a9b5725
seed past waifu part 1
leomotors Oct 22, 2023
b35e0ff
remove svelte favicon
leomotors Oct 23, 2023
b93185c
feat: enhance home page
leomotors Oct 24, 2023
864e04d
update past waifu data complete
leomotors Oct 24, 2023
2bd0cb8
chore: readme
leomotors Oct 24, 2023
e28b11e
chore: fix ci and build docker
leomotors Oct 25, 2023
c19cb6e
chore: deps
leomotors Oct 25, 2023
77202ca
past waifu now works without javascript
leomotors Oct 25, 2023
466b130
Merge branch 'main' into web
leomotors Oct 25, 2023
f5e7bbb
ci: update ci version
leomotors Oct 25, 2023
d8e5570
feat: get accept language
leomotors Oct 25, 2023
8876419
web: better parse accept language
leomotors Oct 25, 2023
fd42ab9
db: use autoincrement for waifu id
leomotors Oct 25, 2023
216be23
landing page improvements
leomotors Oct 25, 2023
31947df
crud activity done
leomotors Oct 26, 2023
a86f44b
chore: deps
leomotors Nov 15, 2023
0d1729a
remove unused and vulnerable lib
leomotors Nov 15, 2023
ef9652b
admin waifu page
leomotors Nov 15, 2023
b6a56ac
fix build error
leomotors Nov 16, 2023
6f4b32f
migration dockerfile
leomotors Nov 16, 2023
5b87d64
waifu data form
leomotors Nov 16, 2023
101afa8
update waifu data part 1
leomotors Nov 18, 2023
d214ade
update waifu data part 2
leomotors Nov 18, 2023
d8c1549
update waifu data complete
leomotors Nov 18, 2023
8ed72bc
web: unable to change simping waifu
leomotors Nov 18, 2023
32b4390
waifu sync part 1
leomotors Nov 18, 2023
b6d4253
waifu sync part 2: webhook done
leomotors Nov 18, 2023
d5dc2ae
prob ready for prod
leomotors Nov 18, 2023
c5dcd2b
chore: deps
leomotors Nov 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
.github
.vscode
.git
.DS_Store
__MACOSX
**/.DS_Store
**/__MACOSX

# Unrelated folders/files at root
images
Expand Down
23 changes: 22 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,2 +1,23 @@
# TODO
# Discord Bot
DISCORD_TOKEN=
ENVIRONMENT=PRODUCTION
DEV_GUILD_ID=

TENOR_APIKEY=
GOLDEN_FRAME_ENDPOINT=
GOLDEN_FRAME_APIKEY=

SPEECH_KEY=
SPEECH_REGION=

PUBLIC_WEB_URL=

FILE_UPLOAD_SERVER=
FILE_UPLOAD_KEY=

# Internal Auth
INTERNAL_SECRET=
JWT_SECRET=

# Database
DATABASE_URL="postgresql://username:password@localhost:5432/waifubot"
9 changes: 7 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
uses: pnpm/action-setup@v2

- name: Setup node with cache
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: pnpm
Expand All @@ -51,12 +51,17 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: winterjung/split@v2
id: version
with:
msg: ${{ github.ref_name }}

- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: .
file: Dockerfile
push: true
tags: ghcr.io/leomotors/waifu-bot:${{ github.ref_name }},ghcr.io/leomotors/waifu-bot:kanade,ghcr.io/leomotors/waifu-bot:latest
tags: ghcr.io/leomotors/waifu-bot:${{ github.ref_name }},ghcr.io/leomotors/waifu-bot:v${{ steps.version.outputs._0 }},ghcr.io/leomotors/waifu-bot:latest
cache-from: type=gha
cache-to: type=gha,mode=max
5 changes: 4 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
uses: pnpm/action-setup@v2

- name: Setup node with cache
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: pnpm
Expand All @@ -28,6 +28,9 @@ jobs:

- name: Build everything
run: pnpm build
env:
INTERNAL_SECRET: mockvalueforci
JWT_SECRET: mockvalueforci

- name: Lint
run: pnpm lint
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
engine-strict=true
ignore-workspace-root-check=true
save-exact=true
public-hoist-pattern[]=*prisma*
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
lts/hydrogen
lts/iron
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ? Builder: Build dependencies like @discordjs/opus and everything
# ? -------------------------

FROM node:18-alpine as builder
FROM node:20-alpine as builder

WORKDIR /app

Expand All @@ -14,13 +14,16 @@ RUN corepack enable

RUN pnpm i --frozen-lockfile

ENV INTERNAL_SECRET tempmockvalue
ENV JWT_SECRET tempmockvalue

RUN pnpm build

# ? -------------------------
# ? Runner: Copy stuff from builder to save spaces from added apk packages
# ? -------------------------

FROM node:18-alpine as runner
FROM node:20-alpine as runner

WORKDIR /app

Expand Down
84 changes: 42 additions & 42 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,55 +1,38 @@
# Waifu Bot

Waifu Bot is the bot that is serving _our_ server
Waifu Bot is a multipurpose discord bot that is serving _our_ server

Current Waifu we SIMP: <ruby>宵崎奏<rt>Yoisaki Kanade</rt></ruby>

Nominated and image selected by @Qwenty228

![](./images/kanade-me-when.webp)

![](./images/kanade-meme.webp)

**Current Version**: 5.2
**Been SIMPing since**: 5.2.820
See waifu we currently simp and the history at https://waifu.leomotors.me

## 📚 Tech Stack

Coming soon

<details>
<summary>Old tech stack</summary>

My 2023 reaction: เลอะเทอะ

The most ~~over-engineered~~ advanced Discord Bot
Tech stack used, starting in version 6

![](./images/cringe-tech-stack.png)

</details>
Coming soon

## ✨ Features

- Mainly: Music from YouTube with power of [@cocoa-discord/music-module](https://github.com/Leomotors/cocoa-discord/blob/main/packages/music-module/README.md#%EF%B8%8F-highlight) << some gallery there

- Personal Playlist for each user with website for them to edit

- Miscellanous ~~useless~~ features

- [Golden Frame](https://github.com/Leomotors/golden-frame)!

- Using Cocoa Discord and 💛JavaScript💛

- ศูนย์รวมจิตใจของคนในเซิร์ฟเวอร์

## 🐇 How to run the bot

### Prerequisites

- Your Discord Bot (of course)
- nodejs 18 (1s<sup>1</sup>)
- nodejs 20 ([Ar] 3d<sup>6</sup> 4s<sup>2</sup>)
- pnpm 8
- ~~PostgreSQL Database and Public Server (VM) for Website~~ not yet but might be soon
- PostgreSQL Database and Public Server (VM) for Website
- Tenor API Key
- [Golden Frame Server](https://github.com/Leomotors/golden-frame) deployed somewhere
- Azure Cognitive Services for TTS

### Steps

Expand All @@ -62,36 +45,51 @@ The most ~~over-engineered~~ advanced Discord Bot

`docker pull ghcr.io/leomotors/waifu-bot:latest`

## Waifu Bot Archive
## Technical details on history

The Discord Bot (apps/bot) was built on top of [CarelessDev/harunon.js](https://github.com/CarelessDev/harunon.js)

Below are list of previous waifu we chose to SIMP
Shikimori-san and later are in this repository.

- **Version 4.1.700 - 5.1.810** Kaede [v5.1.810](https://github.com/Leomotors/waifu-bot/tree/5.1.810) &lt;September 2023 - October 2023 (2ヶ月)&gt;
Yukinoshita Haruno were in [CarelessDev/harunon.js](https://github.com/CarelessDev/harunon.js)
for new JavaScript version and [CarelessDev/Harunon](https://github.com/CarelessDev/Harunon)
for old Python version.

- **Version 4.0.640 - 4.0.662** Bocchi [v4.0.662-bocchi](https://github.com/Leomotors/waifu-bot/tree/v4.0.662-bocchi) &lt;November 2022 - September 2023 (11ヶ月)&gt;
The first ever Waifu Bot, or said first useful discord bot in our server is at [CarelessDev/SIMP-Bot](https://github.com/CarelessDev/SIMP-Bot)

- **Version 4.0.605 - 4.0.629** Vergil [v4.0.629](https://github.com/leomotors/waifu-bot/tree/v4.0.629) &lt;August 2022 - ~~No Nut~~ November 2022 (4ヶ月)&gt;
### Version History

- **Version 3.2 - 4.0.600** 式守さん (Shikimori-san) [v3.2](https://github.com/leomotors/waifu-bot/tree/v3.2) | [v4.0.600](https://github.com/leomotors/waifu-bot/tree/v4.0.600) &lt;July 2022 - August 2022 (2ヶ月)&gt;
**Version 1** -> Python Skittle-chan Era
**Version 2** -> Python Harunon Era
**Version 3** -> JavaScript
**Version 4** -> Full Stack Waifu with Turborepo

- **Version 3.0 - 3.1** 雪ノ下陽乃 (Yukinoshita Haruno) [Repository](https://github.com/CarelessDev/harunon.js) &lt;Mar 2022 - July 2022 (5ヶ月)&gt;
_Version 4.1_ -> Removed full stack website (because it is broken and lazy to fix)

- **Version 2.0** 雪ノ下陽乃 (Yukinoshita Haruno) But it was in Python [Repository](https://github.com/CarelessDev/Harunon) &lt;November 2021 - Mar 2022 (5ヶ月)&gt;
**Version 5** -> Few breaking changes

- **Version 1.0** Skittle Chan [Repository](https://github.com/CarelessDev/SIMP-Bot) &lt;Sep 2021 - November 2021 (3ヶ月)&gt;
- Cocoa Discord ~~Utils~~ v3
- Major changes to some feature, see changelog

## Technical Version History
**Version 6** -> Brought back website with better stack

Version 1 -> Python Skittle-chan Era
Version 2 -> Python Harunon Era
Version 3 -> JavaScript
Version 4 -> Full Stack Waifu with Turborepo
- No more graphql with separate NestJS backend to reduce overhead. It is too overkill and suck.
- also Next.js
> Why I don't use Next.js: https://www.youtube.com/watch?v=jM0njSK-bPg&t=338s
- still use Prisma, cannot move away to other 😭

> _Version 4.1 -> Removed full stack website_
### Previous Tech Stack

Version 5 -> Only Bot (will add website in Version 6)
<details>
<summary>Version 4 Tech Stack</summary>

My 2023 reaction: เลอะเทอะ

The most ~~over-engineered~~ advanced Discord Bot

![](./images/cringe-tech-stack.png)

</details>

## Utility Library behind this Bot!

Expand All @@ -105,4 +103,6 @@ Version 5 -> Only Bot (will add website in Version 6)

(at version 4.0.605)

yes, I'm lazy to update these photo

![](https://pbs.twimg.com/media/FaSN9feUYAAU3yj?format=jpg&name=large)
3 changes: 1 addition & 2 deletions apps/README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# apps

- bot -> Discord Bot
- client -> Website Frontend for Users to edit their playlist
- server -> Backend Server with Database
- web -> Website for admin management and for user to do some stuff
10 changes: 0 additions & 10 deletions apps/bot/.env.example

This file was deleted.

106 changes: 0 additions & 106 deletions apps/bot/.gitignore

This file was deleted.

Loading