REPOSITORY / ScuroNeko/Laniakea

Issues

ISSUES REPOSITORY

Config from TOML/JSON #11

Closed
opened 2026-04-22 18:35:35 +03:00 by ScuroNeko · 0 comments
Owner

Add ability to load and create BotOpts by loading toml/json files.

  1. Create interface for loading opts from file. It should realize FromBytes/ToBytes.
  2. Create Bot#LoadFileOpts(filename string) error and Bot#SaveFileOpts(filename string) error
  3. LoadFileOpts opens file and emits BotOptsLoader#FromBytes, Bot#SaveFileOpts(filename string) opens file, emits BotOptsLoader#ToBytes and write bytes into file
  4. In Bot make field botOptsLoader BotOptsLoader. If nil, Load/SaveFileOpts should return error

Types:

interface BotOptsLoader {
    FromBytes([]byte) BotOpts
    ToBytes(BotOpts) []byte
}
Add ability to load and create BotOpts by loading toml/json files. 1. Create interface for loading opts from file. It should realize FromBytes/ToBytes. 2. Create `Bot#LoadFileOpts(filename string) error` and `Bot#SaveFileOpts(filename string) error` 3. `LoadFileOpts` opens file and emits `BotOptsLoader#FromBytes`, `Bot#SaveFileOpts(filename string)` opens file, emits `BotOptsLoader#ToBytes` and write bytes into file 4. In `Bot` make field `botOptsLoader BotOptsLoader`. If nil, Load/SaveFileOpts should return error Types: ```go interface BotOptsLoader { FromBytes([]byte) BotOpts ToBytes(BotOpts) []byte } ```
ScuroNeko added the Kind/Feature
Priority
Low
4
labels 2026-04-23 23:40:02 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: ScuroNeko/Laniakea#11