matrix-org / matrix-org/matrix-js-sdk

Make the client only see events from after it was turned on

Open
#843 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

T-Other
Dominant language
TypeScript
Stars
2.2k
Forks
704
Avg merge
1d 20h
Merged PRs (30d)
40

Description

Hi, I'm trying to make a very simple bot that greets users when they enter a room. Source code: https://gitlab.com/alexgleason/solarus-welcome-bot/blob/master/bot.js

Concept:

![screenshot from 2019-02-14 15 52 24](https://user-images.githubusercontent.com/3639540/52816993-8b1e4d00-3070-11e9-86fd-239abec88baf.png)

The problem is, it keeps getting all these events I don't need. Finally, I realized I could do this:

```js
event.event.unsigned.age < 6000
```
to check if an event is from the past 60 seconds. This is good enough, but it doesn't seem to always work. For instance, it always greets t2bot's Discord Bridge user (`@_discord_bot:t2bot.io`) when it starts up, and I don't know why.

My desired behavior is to make the bot start up, mark everything as read, then from that point on respond to room join events.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked bot.js and the event.event.unsigned.age check to understand how room events are received at startup. Trace the SDK entry point that delivers those events and determine how startup state can be marked read; done means the bot ignores existing events but responds to room joins occurring afterward.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
api
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.