@rcpooley/botyard 0.4.1 → 0.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/watch.js +5 -3
- package/package.json +6 -1
package/dist/watch.js
CHANGED
|
@@ -77,7 +77,7 @@ export async function watch(o) {
|
|
|
77
77
|
// catch up on what was posted while it was down; the stream's own copy of
|
|
78
78
|
// any of those is skipped by the id check in print().
|
|
79
79
|
if (last > 0n)
|
|
80
|
-
await catchUp(o, [...asked, ...seen.values()], seen, print);
|
|
80
|
+
await catchUp(o, [...asked, ...seen.values()], seen, print, o.includeOwn ? null : me.bot.userId || me.bot.id);
|
|
81
81
|
else {
|
|
82
82
|
const named = [...o.servers.map((s) => `all of ${s}`), ...o.channels.map((c) => `${c} and its threads`), ...o.threads.map((c) => `thread ${c}`)];
|
|
83
83
|
const scope = named.length ? named.join(', ') : 'every server, channel and thread this key can read';
|
|
@@ -115,13 +115,15 @@ function named(ref, thread) {
|
|
|
115
115
|
return { server: { id: server, name: server }, channel: { id: channel, name: channel, thread, parentId: null, parentName: null } };
|
|
116
116
|
}
|
|
117
117
|
/** Read the channels and threads this run has seen and print what is newer than the last message printed, oldest first. */
|
|
118
|
-
|
|
118
|
+
// `own` is the bot's user id when its own messages are to be left out: the
|
|
119
|
+
// stream drops them server-side, but catch-up reads history, which has them.
|
|
120
|
+
async function catchUp(o, channels, seen, print, own) {
|
|
119
121
|
const missed = [];
|
|
120
122
|
for (const where of channels) {
|
|
121
123
|
try {
|
|
122
124
|
const page = await call(o.url, o.key, 'GET', `/servers/${seg(where.server.id)}/channels/${seg(where.channel.id)}/messages?limit=100`);
|
|
123
125
|
// A channel asked for by name prints under its real name once one of its messages has come through the stream.
|
|
124
|
-
missed.push(...page.messages.map((m) => ({ ...m, ...(seen.get(m.channelId) ?? where) })));
|
|
126
|
+
missed.push(...page.messages.filter((m) => m.author.id !== own).map((m) => ({ ...m, ...(seen.get(m.channelId) ?? where) })));
|
|
125
127
|
}
|
|
126
128
|
catch (e) {
|
|
127
129
|
o.log(`botyard: could not catch up on ${place(where)} (${e instanceof Error ? e.message : e})`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rcpooley/botyard",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.3",
|
|
4
4
|
"description": "Read and send in Discord through your own bot, hosted by Botyard. Made for AI agents.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -24,5 +24,10 @@
|
|
|
24
24
|
"claude"
|
|
25
25
|
],
|
|
26
26
|
"homepage": "https://botyard.rcpooley.dev",
|
|
27
|
+
"repository": {
|
|
28
|
+
"type": "git",
|
|
29
|
+
"url": "git+https://github.com/roddbert/botyard.git",
|
|
30
|
+
"directory": "cli"
|
|
31
|
+
},
|
|
27
32
|
"license": "UNLICENSED"
|
|
28
33
|
}
|