option or metainfo to include/exclude own messages
malgorithms opened this issue · comments
some people like to write bots that act as themselves in a team setting, say so they can ask for reminders or order lunch without adding a bot account to their team, and currently watchAllChannelsForNewMessages
and watchChannelForNewMessages
don't include those messages.
Two options:
(1) include a user's own messages but expose some extra meta information on messages, so a bot author can easily filter them out:
sentByMe
- whether the message sender was the bot's user (e.g. bot running aschris
, sender was `chris)sentFromThisDevice
- whether the message was sent by the same paperkey/device as the bot is usingsentFromThisBot
- whether it actually was initiated from this exact bot instance. note this is different fromsentFromThisDevice
because you might run 2 totally different bot scripts with the same paperkey, and want them to see each other's messages but not get triggers on their own.
(2) instead of that info coming back in messages, make them filter options on the call. This is slightly more convenient for shorter scripts but has the disadvantage that it complicates the creation of the function, and I'm hesitant to make these functions even more complicated.
This strategy will come up elsewhere. People often only want to watch for text messages or attachments or whatever, or maybe they actually care to get message edits. Currently we're letting the user filter, which seems simpler. That might be the right answer.
Whichever we choose should get a test.
Just wanted to toss in that if we go with approach 1, then our message types start to deviate from the types that are returned by the service. That being said, we may want to do that as it would make for a better API but I think it's important that we're aware of such a change.