Mute a list of words in Tweetbot


#1

https://actions.getdrafts.com/a/1K2

I made an action to mute a list of words in tweetbot. I would like to take it further (such as pick a duration and enable the filter automatically) but I don’t think the Tweetbot url scheme allows for it.


#2

A couple of quick thoughts about small details

  • you are reading the draft but not writing to it, so perhaps you don’t particularly need the draft.update() ?
  • just in case there are any special or accented characters in the terms that people would like to mute, perhaps just encode the whole thing, rather than manually inserting pre-encoded pipes ?

one alternative would be to write something along the lines of this, for example:

(() => {
    const
        url = 'tweetbot:///mute/keyword?regex=1&text=' +
        encodeURIComponent(
            '(?i)' + draft.content
            .split('\n')
            .join('|')
        );
    return (
        // Effects, and
        app.openURL(url),
        app.displayInfoMessage(url),

        // value – for testing etc.
        url
    );
})();

#3

I will look at that, thank you!

The update was left from earlier versions.

I’ll look at the encoding. I have a Workflow that does that but I wasn’t sure how to do it in JS. (I’m just starting to look at it). An earlier version wrote to the draft and I used a url action to encode the [[draft]]. I think of myself as an Automator not a programmer. So url schemes are as deep as I go usually. Those I get. JS I’m wrapping my head around.

Thank you for the advice!