Go to file
Hri7566 d3499d2bbd Add debug mode, prefix config file 2023-12-06 19:31:08 -05:00
config Add debug mode, prefix config file 2023-12-06 19:31:08 -05:00
prisma Add balance system 2023-12-02 16:54:39 -05:00
src Add debug mode, prefix config file 2023-12-06 19:31:08 -05:00
.env.template Add Discord support 2023-12-05 23:57:59 -05:00
.gitignore Add VSCode folder to .gitignore 2023-12-03 03:41:46 -05:00
.prettierrc init 2023-10-16 10:09:46 -04:00
README.md Update README.md 2023-12-02 17:49:31 -05:00
bun.lockb Add Discord support 2023-12-05 23:57:59 -05:00
bunfig.toml init 2023-10-16 10:09:46 -04:00
package.json Add version info in logs on startup, clean up MPP config, include package.json in tsconfig, add version to package.json 2023-12-06 01:27:53 -05:00
pm2.config.cjs Attempt to fix pm2 config (5) 2023-12-06 15:27:52 -05:00
tsconfig.json Add version info in logs on startup, clean up MPP config, include package.json in tsconfig, add version to package.json 2023-12-06 01:27:53 -05:00

README.md

supercosmic

This is essentially Cosmic "2.0", but I don't intend to strictly remake everything, it's more of a spiritual successor that shares the name.

Cosmic was a space-themed economy bot that could run on multiple different services, such as Discord and Multiplayer Piano. Initially, it was my learning project. I would implement bad things to learn why they're bad.

Supercosmic is another space-themed economy bot that streamlines tech that I consider new, yet sustainable and active. This way, the dependencies that I use aren't usually outdated.

To give an example, Supercosmic uses Bun.

I also plan to use hyperimport somehow in the future to edge into C++ or rust a bit.

Usage

To install dependencies:

bun install

To copy envorionment variables:

cp .env.template .env

To setup Prisma (PostgreSQL required):

bunx prisma db push

To run:

bun .

Configuring

Pretty much all of the available settings for things are in the config directory. If a config file doesn't exist, it is generated with default data at launch. Configs are only loaded once and are not yet hot-reloadable.

  • balance.yml: Balance (money) configuration
  • mpp_net_channels.yml: MPP.net channels to connect to
  • roles.yml: Roles and corresponding permissions
    • There isn't a clean way to add roles yet. They're handled by an enum in the Prisma schema.
    • In order to give someone a role, currently, the /help menu in the console can help you with that.
    • Roles can be hierarchial by using the inherits property. The best explanation I have is that it works kind of like Lua metatables.
  • services.yml: List of services to connect to
    • This file can control the connection to entire sites, i.e. MPP.net could be disabled, or the console
    • If you receive crashes while using PM2 to host, turn off the console service.
  • switchchat.yml: SwitchCraft Chatbox config
    • SwitchCraft 3 is a Minecraft server that primarily uses the ComputerCraft: Tweaked mod. They have a custom chat system that allows for user-created commands.

Project Hierarchy

  • src: Source code folder
    • commands: Command logic
      • commands: Command group folder
        • economy: Economy commands
        • fun: Fun commands
        • general: General commands
        • utility: Utility commands
    • data: Data handlers
    • economy: Economy helpers & intervals
    • permissions: Roles & permissions
    • services: Connections to outside sites (service agents)
      • console: Console agent & microcommand handler
      • mpp: MPP/MPP.net client
      • switchchat: SwitchCraft 3 Chatbox client
    • util: Utilities & miscellaneous helpers

Info

This project was created using bun init in bun v1.0.4. Bun is a fast all-in-one JavaScript runtime.