Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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 CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ The format is based on [Semantic Versioning](https://semver.org/).
## [Unreleased]
### Added
- `@ai <question>` in a channel: the AI (Cloudflare Workers AI, `ai_chat.py`) answers in that channel, as short plain text for screen readers, followed by `AI_CHAT_DISCLAIMER` ("AI bisa salah. Periksa kembali info penting."). It remembers the channel's last few questions for follow-ups, never gets nicknames, and has a per-person cooldown and a daily limit; answers with clear badwords are replaced by a refusal. Off by default (`/abt aichat`); users can read `/help ai`.
- Natural language bot commands via Function Calling for `@ai`: users can speak commands naturally (e.g. `@ai matiin word filter dong`, `@ai matiin moderation`, `@ai kick orang yang namanya kak fian dong`, `@ai siapa aja yang lagi online?`). Features 18 distinct tools covering moderation toggling (`toggle_moderation_feature`, `get_moderation_status`, `forgive_user`, `temp_ban_user`, `unban_user`), user management, badwords list management, and server inspection. Sensitive operations strictly verify admin privileges (`USERTYPE_ADMIN`), rejecting unauthorized calls with a Gen Z refusal. If an unsupported action is requested, the AI informs the user that the function is not yet available. Includes safe cross-thread tool dispatching and screen reader sanitized plain-text output.
- Guest accounts (`tamu`, `hadirin`) are blocked from using `@ai <question>` in channels by default (`AI_CHAT_BLOCKED_USERS`), with a private notification (`AI_CHAT_BLOCKED_MESSAGE`).
- Optional AI context check (`ai_review.py`, Cloudflare Workers AI): when every badword in a message is an ambiguous one (`AI_AMBIGUOUS_WORDS`, e.g. anjing, babi, tahi, telanjang, gay), the bot asks the AI whether it was an insult instead of counting it right away, so "anjing tetanggaku berisik" is not punished but "anjing lah" is. The AI also sees up to `AI_CONTEXT_MESSAGES` earlier messages and two follow-ups (kept in memory only, without names), so a lone "anjing" after "aku punya binatang baru" is read as the pet. Runs in the background; if the AI does not answer the message is not counted. Off by default, switched with `/abt ai` (refused until the credentials are in `config.json`); `/bwt` shows the AI's verdict; `tools/ai_eval.py` measures a model on 42 labelled sentences. Setup: `docs/ai.md`.
- GitHub Actions workflow (`.github/workflows/deploy.yml`): pull requests into `main` are checked (all Python files must compile), and merging into `main` updates and restarts the bot on the server over SSH through `tools/deploy.sh`, using a key that can only run that script. Setup: `docs/deploy.md`.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ All wizards support `/cancel` to abort. Output is chunked automatically if respo

Optionally, an AI model on Cloudflare Workers AI decides whether an ambiguous badword was meant as an insult ("anjing tetanggaku berisik" is about a dog, "anjing lah" is a curse). Only messages whose matches are all ambiguous are sent, with a few surrounding messages as context (so a lone "anjing" after "aku punya binatang baru" is understood), without names or IPs; if the AI does not answer, the message is not counted. Setup and evaluation: [`docs/ai.md`](docs/ai.md). Switch: `/abt ai`.

Users can also ask the AI in a channel: a message starting with `@ai` gets an answer in that channel, followed by a short "AI can make mistakes" note (`/abt aichat`, `/help ai`).
Users can also ask the AI in a channel: a message starting with `@ai` gets an answer in that channel, followed by a short "AI can make mistakes" note (`/abt aichat`, `/help ai`). It also supports natural language bot commands via function calling (e.g. `@ai kick orang yang namanya kak fian dong`), with admin permission checks on sensitive actions.

## Deployment

Expand Down
Loading
Loading