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: add scoreboard for coubeh #117

Draft
wants to merge 97 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 95 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
6e1ad1b
feat: add voice-on-demand functionality (#2)
potb May 18, 2023
29da9a6
chore(deps): update all dependencies (#3)
renovate[bot] May 18, 2023
14b2a0f
refactor(handlers): move conditional logic into handler files (#4)
potb May 19, 2023
6077dd1
chore(deps): update all dependencies (#6)
renovate[bot] May 19, 2023
f32fb8b
ci: make deployment use the production environment (#7)
potb May 19, 2023
ea336aa
chore: remove unused dependency
potb May 19, 2023
28491b6
chore(deps): update all dependencies (#9)
renovate[bot] May 29, 2023
fd38396
chore(deps): update dependency type-fest to v3 (#8)
renovate[bot] May 29, 2023
09fc4ca
chore(deps): update all dependencies (#10)
renovate[bot] Jun 3, 2023
9774856
chore(deps): update all dependencies (#11)
renovate[bot] Jun 11, 2023
34ced5d
chore(deps): update dependency tsup to v7 (#13)
renovate[bot] Jun 18, 2023
c4601e1
chore(deps): update all dependencies (#12)
renovate[bot] Jun 18, 2023
a98f838
chore(deps): update all dependencies (#14)
renovate[bot] Jun 23, 2023
325427c
chore(deps): update all dependencies (#15)
renovate[bot] Jul 1, 2023
84e5ba9
chore(deps): update all dependencies (#16)
renovate[bot] Jul 3, 2023
3653452
chore(deps): update all dependencies (#17)
renovate[bot] Jul 13, 2023
d38e2dd
chore(deps): update all dependencies (major) (#18)
renovate[bot] Jul 14, 2023
bae02d5
chore(deps): update dependency eslint to v8.45.0 (#19)
renovate[bot] Jul 15, 2023
98dcf28
feat: replace twitter links with vxtwitter alternative (#5)
potb Jul 18, 2023
4e5c806
fix: better url mapping vxtwitter (#23)
Yanzi-dev Jul 18, 2023
03e5dd4
chore(deps): update all dependencies (#24)
renovate[bot] Aug 2, 2023
96ee37e
chore(deps): update dependency type-fest to v4 (#25)
renovate[bot] Aug 2, 2023
97337fa
feat: add 'fart' slash command (#26)
luca-montaigut Aug 2, 2023
5917f5e
feat: cool links voting system and autothread (#27)
luca-montaigut Aug 2, 2023
ff6742f
test: add tests to the project (#20)
potb Aug 5, 2023
770a659
chore(deps): update all dependencies (#32)
renovate[bot] Aug 9, 2023
4b591b3
chore(deps): update dependency eslint-config-prettier to v9 (#33)
renovate[bot] Aug 9, 2023
f341bec
chore(deps): update all dependencies (#37)
renovate[bot] Aug 12, 2023
c5ada12
feat: summarize cool links youtube videos (#40)
astahmer Aug 20, 2023
52fd67c
chore(deps): update all dependencies (#39)
renovate[bot] Aug 23, 2023
21e8856
chore(deps): update all dependencies (#42)
renovate[bot] Aug 26, 2023
9339d3e
chore(deps): update all dependencies (#43)
renovate[bot] Aug 29, 2023
1c7fc96
feat: summarize cool pages (#41)
djang0dev Aug 30, 2023
ef17bbe
fix: isASocialNetworkUrl() regex for summarize-cool-pages (#44)
djang0dev Aug 30, 2023
26f0f06
chore: fix linting and formatting (#47)
neolectron Sep 2, 2023
0644538
chore(deps): update all dependencies (#46)
renovate[bot] Sep 2, 2023
b9854c9
refactor: modularize commands and handlers (#48)
neolectron Sep 3, 2023
9221e88
fix: fire event 'ready' on modules (#50)
neolectron Sep 4, 2023
211801d
feat: quoi feur (#52)
luca-montaigut Sep 4, 2023
79fb2e9
feat: allow modules to export intents (#55)
neolectron Sep 5, 2023
9b647eb
feat: manage recurring messages (#53)
luca-montaigut Sep 6, 2023
a2eea82
fix: add intents to recurring message (#60)
luca-montaigut Sep 7, 2023
58ccddd
fix: muted on quoi-feur feature (#61)
luca-montaigut Sep 7, 2023
088f6f6
fix: remove cache entries on delete channel (#62)
luca-montaigut Sep 7, 2023
7713504
fix: change removeEmoji regex to include custom emojis (#63)
dilaouid Sep 8, 2023
6fa4019
feat: better display for recurring messages list (#64)
luca-montaigut Sep 8, 2023
0ba058f
fix: remove width hack (#66)
luca-montaigut Sep 8, 2023
f5dbfcf
fix: adjust coubeh probability (#65)
luca-montaigut Sep 8, 2023
2ceed7c
feat: add ephemeral to bot message (#67)
luca-montaigut Sep 8, 2023
b1d395a
chore(deps): update all dependencies (#70)
renovate[bot] Sep 10, 2023
b221abb
chore(deps): update actions/checkout action to v4 (#71)
renovate[bot] Sep 10, 2023
973161b
fix: remove useless env variables (#72)
luca-montaigut Sep 11, 2023
ceb5709
fix: wrong names of the handlers of quoifeur module (#74)
ayoubqrt Sep 11, 2023
17c107d
fix: use the quoifeurbot in public thread of allowed channels (#73)
dilaouid Sep 12, 2023
9ec51b3
chore(lint): use rule to disable usage of devDeps (#76)
potb Sep 12, 2023
cfe2416
fix: voice lobby now handles multiple guilds (#77)
neolectron Sep 12, 2023
2a57c49
fix(quoi-feur): check if the trigger word is formatted in md (#68)
dilaouid Sep 13, 2023
f25b530
fix: remove audio channel when last member leaves (#79)
neolectron Sep 13, 2023
ceaea24
fix(voice-on-demand): check old state when leaving
potb Sep 13, 2023
26c3cb3
ci: remove duplicated pipeline actions (#83)
neolectron Sep 13, 2023
981c44e
chore(deps): update all dependencies (major) (#88)
renovate[bot] Sep 15, 2023
465777d
chore(deps): update all dependencies (#87)
renovate[bot] Sep 15, 2023
a03ddbe
chore(deps): update dependency @types/node to v20.6.2 (#89)
renovate[bot] Sep 16, 2023
9dae9a0
feat: make modules isolated using creation function (#81)
potb Sep 17, 2023
1fde43a
fix: utf8 char breaks quoifeur (#93)
Sep 23, 2023
dc24fe5
chore(deps): update all dependencies (#95)
renovate[bot] Sep 23, 2023
c64d7d1
chore(deps): update all dependencies (#96)
renovate[bot] Oct 1, 2023
42b3c75
feat: allow deletion of fxtwitter bot link (#86)
ayoubqrt Oct 3, 2023
34de74b
fix: buttons of fixEmbedTweetVideo feature are clickable by anyone (#98)
ayoubqrt Oct 3, 2023
8be062d
chore(deps): update dependency zod to v3.22.3 [security] (#99)
renovate[bot] Oct 4, 2023
5abed14
feat(tweetEmbed): enhance feedback of interaction buttons (#102)
ayoubqrt Oct 7, 2023
4af9e80
chore(deps): update all dependencies (#101)
renovate[bot] Oct 7, 2023
e92c7c3
build(docker): reduce image size (#103)
potb Oct 7, 2023
13688f4
fix(fart): allow everyone to use the command (#104)
potb Oct 7, 2023
5e029f5
chore: rename scripts and workflows so they are more explicit (#106)
potb Oct 7, 2023
e58cc42
chore(deps): update all dependencies (#108)
renovate[bot] Oct 7, 2023
440fb14
fix: handle emojis properly (#105)
potb Oct 7, 2023
e2ad150
fix(voiceOnDemand): remove duplicate channel deletion related code (#…
tonykero Oct 12, 2023
143bc02
fix(commands): add permissions for all slashcommands (#110)
potb Oct 13, 2023
8032141
chore(deps): update dependency cron to v3 (#97)
renovate[bot] Oct 14, 2023
f2a4eaf
chore(deps): update all dependencies (#111)
renovate[bot] Oct 20, 2023
16dff61
chore(deps): update all dependencies (#112)
renovate[bot] Oct 22, 2023
32903d0
implement score command
Alexandre-Chs Oct 27, 2023
fe66ff4
chore(deps): update all dependencies (major) (#113)
renovate[bot] Oct 28, 2023
5a10f1b
chore(deps): update all dependencies (#118)
renovate[bot] Oct 28, 2023
38d3374
fix(env): make errors from environment clearer (#115)
potb Oct 28, 2023
0b4d594
fix(core): ensure modules have unique names (#120)
potb Oct 30, 2023
e29cf12
add: function to add user muted in DB
Alexandre-Chs Nov 1, 2023
e557c80
fix: problem when add new user
Alexandre-Chs Nov 1, 2023
afa8e8d
add: command /scoreboard function
Alexandre-Chs Nov 1, 2023
54321c9
Merge branch 'master' into alexandrechs
Alexandre-Chs Nov 1, 2023
70368a5
chore(deps): update all dependencies (#122)
renovate[bot] Nov 5, 2023
cde8ff3
chore(deps): update all dependencies (#125)
renovate[bot] Nov 11, 2023
a3fd7f0
Merge branch 'master' into alexandrechs
Alexandre-Chs Nov 11, 2023
8a99b47
Update quoiFeurScoreboard.helpers.ts
potb Nov 12, 2023
4c6155e
fix: change key `score`for `scoreQuoiFeur`
Alexandre-Chs Nov 13, 2023
7d31fa2
Merge branch 'alexandrechs' of https://github.com/Alexandre-Chs/disco…
Alexandre-Chs Nov 13, 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
1 change: 1 addition & 0 deletions .dockerignore
11 changes: 11 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# SETUP
DISCORD_TOKEN=

# DB
REDIS_URL=

# CHANNELS
COOL_LINKS_MANAGEMENT_CHANNEL_ID=
COOL_LINKS_MANAGEMENT_PAGE_SUMMARIZER_BASE_URL=

FIX_EMBED_TWITTER_VIDEO_EXCLUDED_CHANNEL_ID=
1 change: 1 addition & 0 deletions .eslintignore
43 changes: 43 additions & 0 deletions .eslintrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
parser: '@typescript-eslint/parser'
parserOptions:
sourceType: module
ecmaVersion: 2022
project: ./tsconfig.json

extends:
- plugin:@typescript-eslint/recommended
- plugin:@typescript-eslint/recommended-requiring-type-checking
- plugin:sonarjs/recommended
- plugin:import/typescript

plugins:
- simple-import-sort
- import
- only-error
- unused-imports

settings:
import/resolver:

rules:
import/exports-last: error
import/first: error
import/no-duplicates: error
import/order: off

simple-import-sort/imports: error
simple-import-sort/exports: error

unused-imports/no-unused-imports: error

import/no-extraneous-dependencies:
- error
- devDependencies: false

overrides:
- files:
- '*.spec.ts'
rules:
import/no-extraneous-dependencies:
- error
- devDependencies: true
22 changes: 14 additions & 8 deletions .github/workflows/deployment.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Deploy application

on:
push:
branches:
Expand All @@ -16,24 +18,28 @@ concurrency:

jobs:
deployment:
name: Perform deployment
runs-on: ubuntu-22.04

permissions: read-all

environment:
name: production
url: http://discord.gg/7Guzz9e

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Login to Heroku
uses: akhileshns/[email protected].13
uses: akhileshns/[email protected].14
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ''
Expand All @@ -43,14 +49,14 @@ jobs:
- name: Login to Heroku Container Registry
run: heroku container:login

- name: Build Docker image for the bot
uses: docker/build-push-action@v4
- name: Build Docker image
uses: docker/build-push-action@v5
with:
push: true
provenance: false
tags: registry.heroku.com/codinglab-discord-bot/worker
cache-from: type=gha
cache-to: type=gha,mode=max

- name: Deploy the bot
- name: Deploy Docker image
run: heroku container:release worker --app codinglab-discord-bot
41 changes: 0 additions & 41 deletions .github/workflows/good-practices.yaml

This file was deleted.

43 changes: 28 additions & 15 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
name: Check integration

on:
pull_request:
branches:
Expand All @@ -11,45 +13,56 @@ on:
- '**deployment.yaml'

jobs:
validate-pr-title:
name: Validate PR title
runs-on: ubuntu-22.04
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

integration:
name: Continuous integration
name: Continuous integration checks
runs-on: ubuntu-22.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}

- name: Setup pnpm
uses: pnpm/[email protected]

- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v3

- name: Setup pnpm
uses: pnpm/[email protected]

- name: Setup Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: pnpm

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Type-check project
run: pnpm typecheck
- name: Check code formatting
run: pnpm check:format

- name: Check code typing
run: pnpm check:types

- name: Lint project
run: pnpm affected:lint
- name: Check code linting
run: pnpm check:lint

- name: Build project
run: pnpm affected:build
- name: Test project
run: pnpm test

- name: Build Docker image for project
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
push: false
cache-from: type=gha
Expand Down
4 changes: 4 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
save-exact=true
prefer-offline=true
engines-strict=true
strict-peer-dependencies=true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
21.1.0
1 change: 1 addition & 0 deletions .prettierignore
32 changes: 32 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<h1 align="center">Contributing our Discord bot</h1>

## Installation

We use [pnpm](https://pnpm.io) to manage our dependencies.
You can [install it](https://pnpm.io/installation) using your preferred
method, but we recommend using [Corepack](https://nodejs.org/api/corepack.html#supported-package-managers) so that you
keep your package manager version in sync with ours.

Make sure you run **Node 20** or the dependencies' installation will fail.
We recommend using [nvm](https://github.com/nvm-sh/nvm) to manage your Node version.

Finally, run `pnpm install`.

## Tooling

We use [Prettier](https://prettier.io/) and [ESLint](https://eslint.org/) to maintain
consistency in our code.
You should set your editor up so that those tools are properly integrated.

Make sure to have [Docker](https://www.docker.com/) & [docker-compose](https://github.com/docker/compose) installed on
your machine as you
will need it to create your development environment.
If needed, you can install it following [its documentation](https://docs.docker.com/get-docker/).

## Making Pull Requests

In order to contribute to the project, you will need to fork the repository first.
Then, create a **Draft pull request** to let us known that you are working on it.
Make sure your title follows the [conventional commits naming scheme](https://conventionalcommits.org/)
as it helps us to sort pull requests (you can view examples searching throughout our git history).
When, you think that your work is ready, mark your PR as **Ready for review**.
42 changes: 42 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
FROM node:21.1.0-alpine as base

WORKDIR /app

RUN corepack enable
RUN apk add --no-cache python3 make g++

COPY pnpm-lock.yaml ./

RUN pnpm fetch

FROM base as build

WORKDIR /app

COPY tsup.config.ts package.json ./
COPY src ./src

RUN pnpm install --frozen-lockfile --offline && \
pnpm run build

FROM base as production-dependencies

WORKDIR /app

COPY package.json ./
RUN pnpm prune --prod && \
pnpm install --production --frozen-lockfile --offline && \
pnpm store prune

FROM node:21.1.0-alpine as application

WORKDIR /app

COPY --from=production-dependencies --chown=node /app/node_modules ./node_modules
COPY --from=build --chown=node /app/dist ./

RUN echo '{"type":"module"}' > package.json

USER node

CMD node --enable-source-maps main.js
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Codinglab

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<h1 align="center">Discord bot</h1>

<p align="center">Discord bot used in our server</p>

<br/>

## Contributing

See our [contributing guide](./CONTRIBUTING.md)
12 changes: 12 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: '3'

volumes:
redis-data:

services:
redis:
image: redis:7.2.3-alpine
ports:
- '6379:6379'
volumes:
- redis-data:/data
Loading