Idefix is a CLI php script that listens on a defined Mastodon «main bot» account for commands in «direct» or «public» toots from users and, according to the commands it receives from a user, it can make any defined «follow bot» account follow or unfollow the user (the user must write from an instance among those for which a «follow bot» account is defined: toots from other instances will be ignored).

pezcurrel 1cf8bfeec8 Removed a «{» that was never closing 1 month ago
README.md bd6e192f40 Updated to help text as it is in 7757a02 idefix commit 1 month ago
idefix 1cf8bfeec8 Removed a «{» that was never closing 1 month ago
idefix.todo 5470e270ba Marked "implement lockfile" as done 1 month ago

README.md

SYNOPSIS

idefix [options] <project directory>

DESCRIPTION

This is idefix v0.2, a CLI php script that listens on a defined Mastodon
«main bot» account for commands in «direct» or «public» toots from
users and, according to the commands it receives from a user, it can make
any defined «follow bot» account follow or unfollow the user (the user
must write from an instance among those for which a «follow bot» account
is defined: toots from other instances will be ignored).
The script can be useful to give users - particularly new ones, with few or
no followers - of a set of Mastodon instances the possibility to make their
public toots appear on the «federated timelines» of the other instances,
helping them to get to read and know each other.
In order for idefix to work, an existing «project directory» has to be
passed as an argument to it, with a file named «idefix.conf» inside it.
This file should contain the accounts definitions - at least two -, one
definition for each line (empty lines and lines with an «;» character on
their first column will be ignored).
Each account definition should follow this syntax:

<account> <label> <token>

The first account definition will be considered as the «main bot» account
definition; the corresponding «label» won’t matter and can be set to
anything (it has to be set to something, though); the corresponding
«token» should be the token of an app that has already been created, with
«read» and «write» privileges, on the «main bot» account. Each
following account definition will be considered as a «follow bot»
account; the corresponding «label» should be set to an easy «short
name» for the account’s domain; the corresponding «token» should be
the token of an app that has already been created, with «follow»
privileges, on the «follow bot» account. The «main bot» account and
every «follow bot» account would better be marked as «bot» accounts on
their instances.
«label» and «token» should be separated from the previous entity by a
single « » (space) character.

--- Example «idefix.conf» file ---
; This line will be ignored and next line too, since it’s empty.

; Next line is the first, so it will define the «main» account.
folbot@aaaa.aaa aiai xA9kZe9zB6EgtjsW5EVr4axYWW46c1TPC-RpQhnkAvw
; Next lines define four «follow bots» accounts.
folbot@bbbb.bbb bibi 7fne902mc0954mi2ollWMNfasdf6aposdfADF9MFN12
folbot@cccc.ccc cici 0XJfrQ2C9ddzB9H3brTcwt-afo3ZOpTN4jmZbQrPoO8
folbot@dddd.ddd didi Gm3lvO4LxwaXkmhW_q6VSvcBkj_05N0bvJc0TlwnTkw
folbot@eeee.eee eiei l8r3kQynViz2BHw5NKBw7GajnkrSCDeqTI58KUfs6X2
--- End of example «idefix.conf» file ---

Assuming all the defined accounts are properly set up, running idefix on a
«project directory» containing this «idefix.conf» file (like in
«idefix my_project_dir») will make it try to process commands in any
«direct» or «public» toot addressed *only* to «folbot@aaaa.aaa»,
*only* if it’s coming from a user from «bbbb.bbb», «cccc.ccc»,
«dddd.ddd» or «eeee.eee» instances (toots coming from other instances,
or with «unlisted» or «followers-only» privacy level, will be ignored).
A «command toot» should have this syntax:

<@main bot account> <command> [command argument[s]]

Idefix understands commands in english and italian language.
«Command» can be one of these:

follow me
 Makes *all* the «follow bot» accounts, except the «follow bot»
 account on the same instance as the sender’s, follow the sender’s
 account.

seguimi
 Same as above, in italian language.

don't follow me
 Makes *all* the «follow bot» accounts, except the «follow bot»
 account on the same instance as the sender’s, unfollow the sender’s
 account.

non seguirmi
 Same as above, in italian language.

follow me from <list of instances’ domains/labels>
 Makes the «follow bot» account on each instance that is mentioned
 or referred to with the corresponding label in the list follow
 the sender’s account. Every instance’s domain or label in the list
 will have to be separated from each other with a « » (space)
 and-or «,» (comma) character.

seguimi da <lista di domini/etichette di istanze>
 Same as above, in italian language.

don't follow me from <list of instances’ domains/labels>
 Makes the «follow bot» account on each instance that is mentioned
 or referred to with the corresponding label in the list unfollow
 the sender’s account. Every instance’s domain or label in the list
 will have to be separated from each other with a « » (space)
 and-or «,» (comma) character.

non seguirmi da <lista di domini/etichette di istanze>
 Same as above, in italian language.

Let’s make some examples, based on the example «idefix.conf» file
above.
User «jimmy@cccc.ccc» sends this «public» toot to «folbot@aaaa.aaa»:

--- Example toot ---
@folbot@aaaa.aaa follow me
--- End of example toot ---

On receiving this toot, idefix will try and make all the defined «follow
bot» accounts except «folbot@cccc.ccc» («folbot@bbbb.bbb»,
«folbot@dddd.ddd», «folbot@eeee.eee») follow «jimmy@cccc.ccc», and
then it will reply to «jimmy@cccc.ccc» with a toot with the same privacy
level as the one it received («direct» or «public»), summarizing the
results.

Then, user «jimmy@cccc.ccc» sends this «public» toot to
«folbot@aaaa.aaa»:

--- Example toot ---
@folbot@aaaa.aaa don't follow me from dddd.ddd, bibi
--- End of example toot ---

On receiving this toot, idefix will try and make «folbot@dddd.ddd» and
«folbot@bbbb.bbb» unfollow «jimmy@cccc.ccc», and then it will reply to
«jimmy@cccc.ccc» with a toot summarizing the results.

OPTIONS

-h, --help
 Show this help text and exit.
-f, --force
 Force run even if a lockfile exists in project directory.
-v, --verbose
 The script will produce a lot of informational output about what
 it’s doing.

EXIT VALUES

0: regular run
1: regular run, but some warnings where emitted
2: idefix encountered a fatal error

NOTES

On every run, idefix writes informations about what it’s doing and
problems it may encounter in a «idefix.log» file in the specified project
directory.

DISCLAIMER AND LICENSE

This program comes with ABSOLUTELY NO WARRANTY; for details see the source.
This is free software, and you are welcome to redistribute it under certain
conditions; see <http://www.gnu.org/licenses/> for details.