Afullyasyncplugin-friendlyMadelineProtosourcebase
Usethissourcecodetomakeyourideasinaniceasyncway!Justfollowthewaythatsourcecodeitselfiswrittenin!
InstructionsTableOfContents1-Installation1.1-UsingTerminal1.1.1-DownloadRepository1.1.2-ConfigAndRun1.2-UsingBrowser1.2.1-DownloadRepository1.2.2-ConfigAndRun2-Anytimeconfiguration2.1-Usingterminal2.2-UsingBrowser3-HowToUse3.1-Plugins3.1.1-Syntax3.1.2-LoadingPluginsOnBot3.1.3-AvailablePlugins3.1.4-AvailableCommands1-Installation1.1-UsingTerminal1.1.1-DownloadRepositoryFirstclonethisrepositoryusinggit:
$gitclonehttps://github.com/realGuys/MadelineProtoPluginSystem.gitGotoit'sdirectory:
$cdMadelineProtoPluginSystem1.1.2-ConfigAndRunJustrunitandconfigitthroughyourterminalandanswerpromptstoconfigyourbotsettings:
$phpindex.phpEnjoyyourfirst(user)botusingthisPluginSystem!
1.2-UsingBrowser1.2.1-DownloadRepositoryDownloadrepositoryaszipfromhere,thenuploaditonyourhostandextractit.
1.2.2-ConfigAndRunRunindex.phpfilethroughyourbrowserandfillaskedformstoconfigyourbotsettings.
Enjoyyourfirst(user)botusingthisPluginSystem!
2-Anytimeconfiguration2.1-UsingterminalRunindex.phpfilewith--configflag:
$phpindex.php--config2.2-UsingBrowserRunindex.phpfileinbrowserwithconfigquery:
https://yourdomain.ext/path/to/index.php?config3-HowToUse3.1-Plugins3.1.1-SyntaxPluginfilesmustreturnanarraywithtwocolumnofvalues,thefirstonedescribesroleofuserusingthecommand,thesecondoneiscommanditself!Youcanmakeapluginwithtwocommandsfortwodifferentrolesjustlikethis:
<?php/***Justanothersimpleplugin**/$commands['role1']['ping']=function(array$update):\Generator{yield$this->messages->sendMessage(['peer'=>$update,'message'=>'Pong!']);};$commands['role2']['hello']=function(array$update):\Generator{yield$this->messages->sendMessage(['peer'=>$update,'message'=>'Pong!']);};return$commands;3.1.2-LoadingPluginsOnBotNoneedtodothat!Thepluginswillautomaticallyloadonstartingbot.
3.1.3-AvailablePluginsThereissomepluginsforaddadminaccesstootherusers,reloadingpluginse.g.toapplynewchangesandsooninthepluginsdirectory,usethamtomakeyourownawesomeplugins!
MaybeImakesomenewpluginsandaddthemtorepositorytoo,youmaycommityourstoo!
3.1.4-AvailableCommandsCommandInformationpingJustasimplepingcommand!getReports(on|off)Enable/DisableerrorreportingaddAdmin(@username|reply)AddsnewadminstobotusingaddAdmin@usernameorsimplyreplythiscommandonamessageaddOwner(@username|reply)Addsnewownerstobot,usejustlikeaddAdmin!delAdmin(@username|reply)Removesadminsfrombot,usejustlikeaddAdmin!listAdminSendsalistofcurrentadminsreloadReloadsPluginSysteme.g.toapplynewchangesrestartRestartsthebotshutdownShutsthebotdown
评论