Commit graph

30 commits

Author SHA1 Message Date
bd3d7b909a
chore: unexport some bot imports 2026-03-15 15:21:50 +01:00
1addcc7ae3
fixup! chore: rename functions 2026-03-15 15:20:41 +01:00
2e1416eb21
refactor(main): remove one layer of indirection
This commit removes the BotAdapter.erased_callback function, which
served as a generic version of BotAdapter.callback that was legible
for zircon.MessageClosure.

However, it is clearer to document how that mechanism works. Therefore
we remove the BotAdapter.erased_callback and instead makes
BotAdapter.callback match the zircon.MessageClosure.callbackFn
signature.
2026-03-15 15:15:49 +01:00
7d444204ef
docs(main): add comments to functions and types 2026-03-15 15:14:59 +01:00
b72d584996
fixup! refactor: extract modules from bot.zig
This comment was added when this refactoring had already been
performed.
2026-03-15 15:06:56 +01:00
1d44645451
chore: rename functions
This commit updates the function to match the naming conventions used
in Zig, where variables and fields are snake_case, but functions are
camelCase and types are PascalCase.
2026-03-15 15:04:56 +01:00
bd1891521e
refactor: move message dispatch logic to bot
This commit moves the logic that governs what action to take when a
message is heard by the bot from the BotAdapter (which should be a
layer only responsible for translating IRC messages to our internal
representation) to the Bot. This makes it possible to test full
conversations in the bot tests.
2026-03-15 14:35:51 +01:00
49a6b79fd9
refactor(commands): move user command tests
This commit just shuffles the test for user commands closer to the
definition of the user commands.
2026-03-15 13:51:26 +01:00
958c00ce6f
refactor(bot): rename bot.hear to bot.store
Clearer what it actually does (i.e. record a message in the backlog)
and also unlocks that name for a dispatch function where we hear any
message and decide what to do with it. Currently that dispatch logic
lives inside BotAdapter in main.zig and that is not ideal.
2026-03-15 13:50:17 +01:00
4d1f22194c
refactor(bot): introduce response type
The response type holds represents the way a bot can respond to a
message it executes and allows us to move the IRC dependency out of
bot and into only the main module.
2026-03-15 13:47:57 +01:00
4f2b9cbce2
test(bot): record recursive substitution test case
Found while the IRC users tried to find bugs in the code base.

Currently the bot does not "hear" the commands of users, which means
that of the following conversation:

```
<jassob> helo, world!
<jassob> s/helo/hello/
```

the only heard messages in the backlog would be the first ("helo,
world!"), the substitution would be parsed and executed, but not added
to the backlog and hence not possible to update.
2026-03-15 12:40:08 +01:00
b0f0daa19d
refactor(commands): add a substitute constructor
This commit recuces some repetitiveness from creating substitution
literals in tests.
2026-03-14 11:43:26 +01:00
a05229f72d
refactor(bot): add newTestMessage helper
This commit reduces the repetitions in the tests when we create new
messages. It hardcodes a bunch of fields that are currently not used,
but might be eventually.
2026-03-14 11:40:47 +01:00
6796a62a5f
fix(bot): don't substitute if there is no typo
This commit fixes an issue where a substitution command replays a
message because there was no needle to replace.
2026-03-11 01:35:37 +01:00
8b15398196
fix(commands): substitute parsing bug
There was a bug in the parsing logic that caused a substitution
command like `s/typo/correction` to crash the bot.

Correct command is of course `s/typo/correction/`, but now it at least
shouldn't crash.
2026-03-11 01:19:33 +01:00
4e11cc9ea1
fix: make admin command parsing more robust
There was a bug in how we parsed admin commands, apparently we never
tested if we could parse `!backlog X` or unknown admin commands.

This commit also make updates to the backlog command construction to
make sure that we don't try to access messages in the backlog that
don't exist.
2026-03-11 00:57:04 +01:00
d237ba9e8a
docs: update README.md 2026-03-11 00:09:28 +01:00
e1e1938359
refactor: extract modules from bot.zig
This commit creates a bunch of new modules that contain code and tests
for various concepts/implementations that used to exist inside
bot.zig.

Notable amongst these are:
- buffer.zig, which contain the circular buffer containing both
  backlog and outbox messages.
- parser.zig, which contain the parser used to parse commands from IRC
  messages.
2026-03-11 00:01:05 +01:00
508e084ddf
refactor(main.zig): move out error reporting 2026-01-04 23:53:32 +01:00
89c63a34c1
chore(bot.zig): store references to messages in bot 2026-01-04 23:52:42 +01:00
9bebf066cf
chore(bot.zig): remove unused code 2026-01-04 23:52:01 +01:00
24b4a0517c
chore(bot.zig): translate help message to English 2026-01-04 23:50:40 +01:00
edb0727dda
chore(bot.zig): add join admin command
Allows an admin to request the bot to join a channel.
2026-01-04 23:49:54 +01:00
7690c8b46d
chore(bot.zig): refactor text parsing logic 2026-01-04 23:49:16 +01:00
1e4c90822a
chore: make stuff work 2025-11-30 22:52:22 +01:00
936bf470c7
wip 2 2025-11-29 01:05:09 +01:00
59293d1690
wip 2025-11-28 23:04:53 +01:00
6efdd9e027
chore: add to do items 2025-11-02 14:15:13 +01:00
6449a7de2d
chore: implement initial bot with substitute command
This commit introduces a Bot struct which is the main type of this
project. The Bot holds a backlog of messages to be able to update a
typo in a message and so on.

So far there is no IRC/TLS implementation, it is only the base logic.
2025-11-02 14:03:12 +01:00
00d2cf3c69
feat: initial commit 2025-10-27 22:16:55 +01:00