2
0
Fork 0
forked from zynk/zynk

Renamed calc to zynk and refactored all relevant parts.

This commit is contained in:
Johannes Findeisen 2026-07-14 23:52:56 +02:00
commit 2247b9a480
5 changed files with 63 additions and 63 deletions

View file

@ -1,19 +1,19 @@
# AGENTS.md — calc
# AGENTS.md — zynk
## Project Overview
`calc` is a single-file IRC bot written in C. It connects to an IRC server, maintains a key-value store via SQLite3 (loaded dynamically at runtime), and responds to commands in channels and private messages.
`zynk` is a single-file IRC bot written in C. It connects to an IRC server, maintains a key-value store via SQLite3 (loaded dynamically at runtime), and responds to commands in channels and private messages.
## Build & Run
- **Build**: `make` (uses `gcc`, requires `libssl-dev` / `libcrypto` / `libdl`)
- **Run**: `./calc -ssl -nick mybot -join "#chan1,#chan2"`
- **Run**: `./zynk -ssl -nick mybot -join "#chan1,#chan2"`
- **Clean**: `make clean`
- **Install**: `make install`
## Code Style
- C99/C11, single file (`calc.c`)
- C99/C11, single file (`zynk.c`)
- No comments in new code unless clarifying a non-obvious edge case
- Error strings use ANSI color macros (`CLR_RED`, `CLR_GREEN`, etc.)
- 2-space indentation, K&R brace style
@ -24,19 +24,19 @@
## Project Structure
```
calc/
calc.c — single-file IRC bot (1129 lines)
zynk/
zynk.c — single-file IRC bot (1129 lines)
Makefile — build system
.gitignore
AGENTS.md — this file
README.md — user-facing docs
```
## Key Modules in calc.c
## Key Modules in zynk.c
### SQLite3 Integration (lines 40–228)
- Dynamically loads `libsqlite3.so.0` from common paths
- Tables: `calc` (key-value store), `ai_pending` (pending AI queries)
- Tables: `zynk` (key-value store), `ai_pending` (pending AI queries)
- Functions: `db_set`, `db_get`, `db_get_raw`, `db_update_lastq`, `db_update_lasta`
### IRC Session (lines 303–317)
@ -72,8 +72,8 @@ calc/
| Command | Description |
|---|---|
| `calc <key>` | Look up a stored value |
| `calc <key> = <value>` | Store a value |
| `zynk <key>` | Look up a stored value |
| `zynk <key> = <value>` | Store a value |
| `!ping` | Responds with pong |
| `!weather [city]` | Current weather (default: Berlin) |
| `!forecast [city]` | 3-day forecast |
@ -87,5 +87,5 @@ calc/
- Do NOT add `#include` that aren't strictly needed
- Do NOT add comments to obvious code
- Match existing style: 2-space indent, no trailing whitespace
- Test with `make && ./calc -h`
- Test with `make && ./zynk -h`
- Keep the single-file structure unless there's a strong reason to split