Somesocialmediaplatformsallowgroupsofuserstopostintoaunified"group"timeline/instance/whateveryouwanttocallit.ThisiscurrentlynotpossibleonMastodonorPleromawithoutgivingallmembersfulllogincredentialstoagroup.tootgroup.pyisanattempttosolvethisspecificusecase.
Howdoesitwork?tootgroup.pyhastobesetuponacomputerandrunperiodically.ItreadsthenotificationsfromtheMastodon/Pleromaaccountitisconnectedtoandfiltersthemformessagestorepost.Therearetwomethodsofcreatingagrouppost.Oneorbothofthemcanbeenabledduringthesetupprocedure.
Publicmentionsofgroupmembersareboostediftheypreceedthegroup'snamewithanExclamationMarklike"!@mastodon"
tootgroup.pycanalsolookfordirectmessagesfromgroupmembers.Ifthegroupis@mentionedattheverybeginning,Themessagewillberepostedasanewpublictootoriginatingdirectlyfromthegroupaccount.Thestatustextaswellasmediafilesareincluded.Theoriginatinguserwillnotbeshownpublicly.(Itcanstillbeseenbyallgroupandinstanceadministratorstough!)
Ifbothrepostmethodsaredisabled,tootgroup.pywillstillrunbutnotrepostanything.
Buthowtosimplyuseit?Writeamessagethatshouldbeboostedbythegroup:Justinclude"!@group_name"anywhereinthetoot.EXAMPLE:"OHAI!justfoundthat!@mastodonthingie!"
Writeamessagethatshouldappearasanewpostfromthegroup:Put"@group_name"attheverybeginningofadirect/privatemessage.EXAMPLE:"@mastodonHEREBETHEMESSAGETEXT"
Howtosetup?Theeasiestwaytoinstalltootgroup.pyisviaPyPI,thePythonPackageIndex.Usepip3installtootgroup.pytoinstallitaswellasallitsdependencies.
ItisalsopossibletodownloadthescriptmanuallyfromtheGitHubrepositoryathttps://github.com/oe4dns/tootgroup.pyInthatcasethenecessarydependencieshavetobeprovidedtoo:
tootgroup.pyrequireshttps://github.com/halcy/Mastodon.pyaswellashttps://github.com/ActiveState/appdirstorun.Installthemviayouroperatingsystem'spackagemanager,piporevenmanually.
tootgroup.pywillguideyouthroughsetupbyaskingallinformationitneedswhenyourunitfromthecommandlineforthefirsttime.BeingsomewhatcomfortablewithPythonscriptingandthecommandlineingeneralmighthelpifdifficultiesshouldappear.
YouneedanaccountonanyMastodonorPleromainstancethatwillactasyourgroupaccount.Thinkaboutifyoushouldmarkitasa"Bot".
Runtootgroup.pyfromthecommandline.
tootgroup.pywillaskyouforallneededsetupdataandtrytogetthemrightbyconnectingtotheMastodon/Pleromaserver.Ifitcannotdoso,itwilltellyouandyoucanretry.Whensuccessful,tootgroup.pywillwritetheconfigurationtoitstootgroup.conffileandreaditfromtherenexttimeyourunthescript.
Theplaceforstoringconfigurationisoperatingsystemdependentbutwillbeshownduringthefirst-run/setupphase.Alocaltootgroup.conffileplacednexttothetootgroup.pyscriptwilloverridethesesettingsthoughandcanbeusedfordevelopmentortestingpurposes.
Ifyouwanttosetuptootgroup.pyformorethanonegroup,youcanrunitagainwhilespecifyingthe"--groupGROUP_HANDLE"flag.Thiswillthengenerateanindependentconfigurationthatwillbereadeachtimeyoucalltootgroup.pyusingthisname.Ifyoudon'tspecifyanygroupname,thehandle"default"iscreatedandusedautomatically
Testthefuncionalitybysendingdirectmessagesand"!@mentions"toyourgroupwhilerunningtootgroup.pymanually.Seeifthingsworkasexpected.Thescriptwillprintanaccordingmessageaftereachsuccessfulrun.Ifeverythingworks,runthescriptperiodicallyviacronandenjoygroop-tooting!
Hereisanexampleforacrontabentrythatrunstootgroup.pyeverytwominutes:
*/2****/path/to/tootgroup.py--groupdefault
Thereisalsothe"-d"or"--dry-run"commandlineflagthatpreventsanytoots.Youcanuseittotestwhatwouldbepostedbythescript.
Use"-h"or"--help"formoreinformationaboutallavailableoptions
评论