Skip to content

Cannot delete/update messages from outbox #9

@tribela

Description

@tribela

Messages from session.getOutbox don't have update and delete function

import { createBot, MemoryKvStore, text, mention } from '@fedify/botkit';

const bot = createBot<void>({
  username: 'somebot',
  name: 'Some Bot',
  summary: text`Bot for test`,
  kv: new MemoryKvStore(),
})

const session = bot.getSession('http://localhost:8000/@somebot');
const message = await session.publish(
  text`Hello World! ${mention("@somebot@localhost:8000")}`,
  {
    visibility: 'public',
  }
);

console.log(`Message: ${message.id}`);
console.log(message.delete);

setTimeout(async () => {
  for await (const message of session.getOutbox()) {
    console.log(`Message: ${message.id}`);
    console.log(message.delete);
    await message.delete();
  }
}, 1000 * 3);


export default bot;
$ deno serve -A ./bot.ts                                                             1 ↵
Message: http://localhost:8000/ap/note/0197e941-914b-7ed8-9fbc-b8f5f595d038
[AsyncFunction: delete]
deno serve: Listening on http://0.0.0.0:8000/
Message: http://localhost:8000/ap/note/0197e941-914b-7ed8-9fbc-b8f5f595d038
undefined
error: Uncaught (in promise) TypeError: message.delete is not a function
    await message.delete();
                        ^
    at file:///tmp/bk/bot.ts:25:25
    at eventLoopTick (ext:core/01_core.js:217:9)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions