fortudon Fediverse fortune bot开源项目

我要开发同款
匿名用户2021年11月08日
22阅读
开发技术Python
所属分类应用工具、IM/聊天/语音工具
授权协议GPL-3.0 License

作品详情

fortudon

Fortudonv4-dev(20200407)

FortudonisaFediversebotdesignedforpostingrandomBSD-stylefortunesdirectlytoMastodonandPleromainstances.Itincorporatesaforkoffortune.pyandincludesitsownFediversebotfeatures.

REQUIREMENTS:

Python3.6orhigherMastodon.pyanditsdependenciescurlFortunefiles,suchasthoseprovidedwithfortune-modorBSDfortune

DIFFERENCESBETWEENFORTUDONANDFORTUNE.PY:

Theoriginalfortune.pywascreatedbyMichaelGoerzin2008.ItwasonlycompatiblewithPython2.cPicklewasusedtocreatedatafiles,withprotocolversion2andextension.pdat.Theprogramworkedinconsistentlydependingontheterminal'scharacterencoding.Offensivefortunefilesendingin-oweresupported,butunliketraditionalBSDfortune,thesefilesarenotROT13-rotated.

https://www.physik.fu-berlin.de/~goerz

fortune.pywasforkedbyVolkerKettenbachin2018andwasdesignedtoworkwithPython3.7.1andUTF-8fortunefiles.cPicklewasreplacedwithPickle,andprotocolwasleftcompatibleatlegacyversion2.

https://gitlab.com/volkerkettenbach/fortune-api/tree/master

FortudonwasforkedfromKettenbach'sfortune.pyin2020byredneonglow.Changesweremadewithregardtouseoflegacycode.Thepickleprotocolwaschangedtoversion4andthefileextensionisnow.p4dat.Aswiththetraditionalfortunepackage,offensivefortunefilesmustbeROT13-rotatedinadditiontoendingin-o.PostingandsearchingoffensivefortuneswillautomaticallyapplyROT13asneeded.

FortudonisdesignedasaFediversebotwithbuiltinsupportforpostingfortunestoPleromaandMastodoninstances.CodefromDarkWebMysteryBot(anotherFediversebotbyredneonglow)wasincorporatedintoFortudon.

https://github.com/redblade7/darkwebmysterybot

Fortudon,likefortune.py,islicensedundertheGPLv3.

TheofficialWebsiteforFortudonis:

https://github.com/redblade7/fortudon

NOTEFORSLACKWARELINUXUSERS:

SlackwareLinux,bydefault,useslatin1encodingratherthanUTF-8ontheterminalandinitsfortunefiles.Thisoccasionallyleadstostrangeerrorswhentryingtocreatethe.p4datfiles,suchas:

'utf-8'codeccan'tdecodebyte0xa3inposition1293:invalidstartbyte

Forthisreason,Slackwareusersmaywanttoforcelatin1encodingratherthanutf8.Todothis,editfortudon.py's"GLOBALVARIABLES"sectionandchangethevalueofENCODINGfrom'utf8'to'latin1'.

Thisalmostneverneedstobechanged.Itisrecommendedtoleaveit'utf8'unlessyouuseSlackwareLinuxandarehavingtheseerrors,otherwiseseriousbugscanhappen.

SETUPTHETOKENFILE:

CreateaFediverseaccountforyourFortudonbot.Setupatokenhere:https://tinysubversions.com/notes/mastodon-bot/Createatokenfilebyrunningthiscommand:curl<commandyouaregiven>>tokenfile.json

Notethatifyouchangethepasswordontheaccount,youwillneedtocreateanewtokenfile.

EXAMPLECOMMANDS:

Showhelp:./fortudon.py-h

Showversion:./fortudon.py-v

Generaterequired.p4datdatafilesforfortunesinfolderfortune-folder:./fortudon.py-ufortune-folder

Displayrandomfortunechosenfromnon-offensivefilesinfortune-folder:./fortudon.pyfortune-folder

Displayrandomlongfortunechosenfromeitherfortune-folder/myfortunes1orfortune-folder/myfortunes2:./fortudon.py-lfortune-folder/myfortunes1fortune-folder/myfortunes2

Postrandomshortfortune,choosingfrombothoffensiveandnon-offensivefilesinfortune-folder,toPleromainstanceNeckbeard,usingtokenfiletokenfile.jsonandpublicvisibility:./fortudon.py-saphttps://neckbeard.xyztokenfile.jsonpublicfortune-folder

Postrandomshortfortune,chosenfromnon-offensivefilesinfortune-folder,toMastodoninstancemastodon.social,usingtokenfilewokenfile.jsonandunlistedvisibility:./fortudon.py-sphttps://mastodon.socialwokenfile.jsonunlistedfortune-folder

VISIBILITY:

Thevisibilityoptionmaybeanyofthefollowing:

direct(onlyvisibletothebotaccount)private(onlyvisibletothebotaccount'sfollowers)public(visibletoeveryone)unlisted(visibletoeveryone,buthiddenfromthepublictimeline)

Inmostcasesyouwouldwanttouseeitherpublicorunlistedforthevisibilityoption.

Enjoy!

-redblade7akaredneonglow

FEDIVERSECONTACTINFO:

@redneonglow@neckbeard.xyz/https://neckbeard.xyz/redneonglow(main)@redneonglow@anime.website/https://anime.website/redneonglow(backup)@redneonglow@weeaboo.space/https://weeaboo.space/redneonglow(backup)

FEDIVERSEBOTSUSINGFORTUDON:

@BitchX@neckbeard.xyz/https://neckbeard.xyz/BitchX@fortunebot@neckbeard.xyz/https://neckbeard.xyz/fortunebot@ShowerThoughts@neckbeard.xyz/https://neckbeard.xyz/ShowerThoughts@YKYWTMSMW@neckbeard.xyz/https://neckbeard.xyz/YKYWTMSMW
查看全文
声明:本文仅代表作者观点,不代表本站立场。如果侵犯到您的合法权益,请联系我们删除侵权资源!如果遇到资源链接失效,请您通过评论或工单的方式通知管理员。未经允许,不得转载,本站所有资源文章禁止商业使用运营!
下载安装【程序员客栈】APP
实时对接需求、及时收发消息、丰富的开放项目需求、随时随地查看项目状态

评论