https://github.com/bastidood/spectro

A multi-channel confession bot for Discord that supports anonymous replies and channel moderation.

https://github.com/bastidood/spectro

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.7%) to scientific vocabulary

Keywords

discord svelte sveltekit typescript
Last synced: 6 months ago · JSON representation

Repository

A multi-channel confession bot for Discord that supports anonymous replies and channel moderation.

Basic Info
  • Host: GitHub
  • Owner: BastiDood
  • License: agpl-3.0
  • Language: TypeScript
  • Default Branch: main
  • Homepage: https://spectro.fly.dev/
  • Size: 3.39 MB
Statistics
  • Stars: 10
  • Watchers: 1
  • Forks: 2
  • Open Issues: 2
  • Releases: 0
Topics
discord svelte sveltekit typescript
Created over 1 year ago · Last pushed 6 months ago
Metadata Files
Readme License Codeowners

README.md

Spectro Logotype

Spectro is a Discord bot that enables your community members to post anonymous confessions and replies to moderator-configured channels. However, for the sake of moderation, confessions are still logged for later viewing.

Development

Spectro is a standard full-stack SvelteKit web application that leverages PostgreSQL as the database layer.

Managing Environment Variables

For convenience, the repository includes env:* scripts for loading environment variables from .env.* files. These are meant to be used as prefixes for other package scripts.

```bash

Run the database migrations with .env.development variables.

pnpm env:dev pnpm db:migrate

Register the Discord application commands.

pnpm env:prod pnpm discord:register ```

Managing the Database

Spectro requires a PostgreSQL database for data persistence. For convenience, we use Docker Compose to set up a local installation. The following environment variables are required for this to work.

| Name | Description | | ----------------------- | ------------------------------------------------------------------ | | POSTGRES_DATABASE_URL | The URL connection string for the PostgreSQL development database. | | POSTGRES_PASSWORD | The password with which to initialize the default postgres user. |

```bash

Download PostgreSQL with Docker (Compose).

Run and initialize an empty database.

Requires POSTGRES_PASSWORD.

docker compose --profile=dev up --detach

Run the database migrations.

Requires POSTGRES_DATABASE_URL already in scope.

pnpm db:migrate

Shut down the PostgreSQL server.

docker compose --profile=dev down ```

Registering Callback Endpoints

The bot relies on two callback endpoints that receives webhook events from Discord:

  1. The interactions endpoint (i.e., /webhook/discord/interaction/) for receiving application commands via HTTP POST requests from Discord.
  2. The webhook events endpoint (i.e., /webhook/discord/event/) for receiving application authorization events from Discord.

Registering the Application Commands

To register the application commands in Discord, a one-time initialization script must be run whenever commands are added, modified, or removed. The script is essentially a simple HTTP POST request wrapper over the Discord REST API.

```bash

Register the application commands.

Requires DISCORD_APPLICATION_ID and DISCORD_BOT_TOKEN already in scope.

pnpm discord:register ```

Running the Web Server

Spectro requires some environment variables to run correctly. If the following table is outdated, a canonical list of variables can be found in the src/lib/server/env/*.ts files.

| Name | Description | | ------------------------ | ------------------------------------------------------------------------------------------------------------------- | | POSTGRES_DATABASE_URL | The URL connection string for the PostgreSQL production database. | | DISCORD_APPLICATION_ID | The publicly known Discord application ID that will be used for the verification of incoming webhooks. | | DISCORD_PUBLIC_KEY | The public key of the Discord application that will be used for the verification of incoming webhooks. | | DISCORD_BOT_TOKEN | The secret key of the Discord application that will be used for the verification of OAuth2 client credential flows. |

The following variables are optional in development, but highly recommended in the production environment.

| Name | Description | | --------------- | ------------------------------------------------------------ | | AXIOM_DATASET | An Axiom dataset to which structured logs will be delivered. | | AXIOM_TOKEN | The Axiom token used to authenticate with the ingest. |

```bash

Install the dependencies.

pnpm install

Synchronize auto-generated files from SvelteKit.

This is automatically run by pnpm install.

pnpm prepare

Start the development server with live reloading + hot module replacement.

pnpm dev

Compile the production build (i.e., with optimizations).

pnpm build

Start the production preview server.

pnpm preview ```

Linting the Codebase

```bash

Check Formatting

pnpm fmt # prettier

Apply Formatting Auto-fix

pnpm fmt:fix # prettier --write

Check Linting Rules

pnpm lint:eslint # eslint pnpm lint:svelte # svelte-check

Check All Lints in Parallel

pnpm lint ```

Legal

The Spectro project is licensed under the GNU Affero General Public License v3.0. However, some files (e.g., brand assets) are exceptions that have been licensed under different terms and limitations. See the COPYING.md file for more details.

Acknowledgements

Spectro is dedicated to the hundreds of students at the Department of Computer Science, University of the Philippines - Diliman who rely on anonymous confessions for their daily dose of technical discourse, academic inquiries, heated rants, quick-witted quips, and other social opportunities.

Let Spectro bind the wider computer science community closer together in pursuit of collaboration in the service of our nation.

  • For the selfless student leaders keeping the spirit of the department alive.
  • For the tireless mentors who frequently share their knowledge and gifts to every academic inquiry.
  • For the seasoned veterans and alumni who impart their wisdom about the "real world" out there.
  • For the harshest critics of the department who only strive for the quality of education that we deserve.
  • For the wittiest comedians who brighten up the otherwise dry discourse.
  • For the persevering pupils who exemplify utmost scholarship even in the face of setbacks.
  • For the struggling students who nevertheless keep pushing out of passion for their craft.
  • For the anonymous lurkers who now feel safer and empowered to participate.

Spectro is here is for you. 👻


Coded with ❤ by Basti Ortiz. Themes, designs, and branding by Jelly Raborar.

Owner

  • Name: Basti Ortiz
  • Login: BastiDood
  • Kind: user
  • Location: Philippines

Just some dood hoping to make a career out of typing programming jargon to make stuff work.

GitHub Events

Total
  • Create event: 5
  • Issues event: 29
  • Watch event: 9
  • Delete event: 6
  • Issue comment event: 6
  • Public event: 1
  • Push event: 136
  • Pull request event: 9
  • Pull request review event: 30
  • Pull request review comment event: 46
  • Fork event: 1
Last Year
  • Create event: 5
  • Issues event: 29
  • Watch event: 9
  • Delete event: 6
  • Issue comment event: 6
  • Public event: 1
  • Push event: 136
  • Pull request event: 9
  • Pull request review event: 30
  • Pull request review comment event: 46
  • Fork event: 1

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 14
  • Total pull requests: 10
  • Average time to close issues: about 1 month
  • Average time to close pull requests: about 4 hours
  • Total issue authors: 1
  • Total pull request authors: 2
  • Average comments per issue: 0.14
  • Average comments per pull request: 0.3
  • Merged pull requests: 10
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 14
  • Pull requests: 10
  • Average time to close issues: about 1 month
  • Average time to close pull requests: about 4 hours
  • Issue authors: 1
  • Pull request authors: 2
  • Average comments per issue: 0.14
  • Average comments per pull request: 0.3
  • Merged pull requests: 10
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • BastiDood (16)
Pull Request Authors
  • Anjellyrika (10)
  • VeeIsForVictor (3)
  • VeeIsForVanana (1)
Top Labels
Issue Labels
docs (8) feat (5) good first issue (2) perf (2) bug (1) blocked (1) enhancement (1)
Pull Request Labels

Dependencies

.github/workflows/ci.yml actions
  • actions/cache v4 composite
  • actions/checkout v4 composite
Dockerfile docker
  • gcr.io/distroless/nodejs22-debian12 nonroot-amd64 build
  • node 22.11.0-alpine3.20 build
docker-compose.yml docker
  • postgres 17.2-alpine3.20
package.json npm
  • @eslint/js ^9.16.0 development
  • @linthtml/linthtml ^0.10.1 development
  • @linthtml/linthtml-config-recommended ^0.1.0 development
  • @sveltejs/adapter-node ^5.2.9 development
  • @sveltejs/vite-plugin-svelte ^5.0.1 development
  • @tailwindcss/typography ^0.5.15 development
  • @types/node ^22.10.1 development
  • @types/pg ^8.11.10 development
  • autoprefixer ^10.4.20 development
  • daisyui ^4.12.14 development
  • dotenv ^16.4.7 development
  • drizzle-kit ^0.29.0 development
  • eslint ^9.16.0 development
  • eslint-config-prettier ^9.1.0 development
  • eslint-plugin-svelte ^2.46.1 development
  • globals ^14.0.0 development
  • prettier ^3.4.1 development
  • prettier-plugin-svelte ^3.3.2 development
  • prettier-plugin-tailwindcss ^0.6.9 development
  • stylelint ^16.11.0 development
  • stylelint-config-standard ^36.0.1 development
  • stylelint-config-tailwindcss ^0.0.7 development
  • svelte-check ^4.1.0 development
  • svelte-eslint-parser ^0.43.0 development
  • tailwindcss ^3.4.15 development
  • typescript ^5.7.2 development
  • typescript-eslint ^8.17.0 development
  • typescript-svelte-plugin ^0.3.44 development
  • vite ^6.0.2 development
  • vite-plugin-tailwind-purgecss ^0.3.5 development
  • @iconify/icons-simple-icons ^1.2.74
  • @iconify/svelte ^4.0.2
  • @noble/ed25519 ^2.1.0
  • @sveltejs/kit ^2.9.0
  • drizzle-orm ^0.37.0
  • pg ^8.13.1
  • pino ^9.5.0
  • svelte ^5.5.0
  • valibot 1.0.0-beta.9
pnpm-lock.yaml npm
  • 160 dependencies