Overview

Namespaces

  • Budabot
    • Core
      • Modules
    • User
      • Modules
  • None
  • Tyrence
    • Modules

Classes

  • AccessLevel
  • Budabot\Core\AccessManager
  • Budabot\Core\AdminManager
  • Budabot\Core\AOChat
  • Budabot\Core\AOChatPacket
  • Budabot\Core\AOChatQueue
  • Budabot\Core\AOExtMsg
  • Budabot\Core\AsyncHttp
  • Budabot\Core\AutoInject
  • Budabot\Core\BotRunner
  • Budabot\Core\Budabot
  • Budabot\Core\BuddylistManager
  • Budabot\Core\CacheManager
  • Budabot\Core\CacheResult
  • Budabot\Core\ClassLoader
  • Budabot\Core\ColorSettingHandler
  • Budabot\Core\CommandAlias
  • Budabot\Core\CommandManager
  • Budabot\Core\ConfigFile
  • Budabot\Core\DB
  • Budabot\Core\DBRow
  • Budabot\Core\EventLoop
  • Budabot\Core\EventManager
  • Budabot\Core\GuildChannelCommandReply
  • Budabot\Core\GuildManager
  • Budabot\Core\HelpManager
  • Budabot\Core\Http
  • Budabot\Core\HttpRequest
  • Budabot\Core\LegacyLogger
  • Budabot\Core\LimitsController
  • Budabot\Core\LoggerWrapper
  • Budabot\Core\MMDBParser
  • Budabot\Core\Modules\AdminController
  • Budabot\Core\Modules\AliasController
  • Budabot\Core\Modules\AltInfo
  • Budabot\Core\Modules\AltsController
  • Budabot\Core\Modules\BanController
  • Budabot\Core\Modules\BuddylistController
  • Budabot\Core\Modules\ColorsController
  • Budabot\Core\Modules\CommandlistController
  • Budabot\Core\Modules\CommandSearchController
  • Budabot\Core\Modules\ConfigController
  • Budabot\Core\Modules\EventlistController
  • Budabot\Core\Modules\HelpController
  • Budabot\Core\Modules\LogsController
  • Budabot\Core\Modules\PlayerLookupController
  • Budabot\Core\Modules\ProfileCommandReply
  • Budabot\Core\Modules\ProfileController
  • Budabot\Core\Modules\SettingsController
  • Budabot\Core\Modules\SQLController
  • Budabot\Core\Modules\SystemController
  • Budabot\Core\Modules\UsageController
  • Budabot\Core\Modules\WhitelistController
  • Budabot\Core\NumberSettingHandler
  • Budabot\Core\OptionsSettingHandler
  • Budabot\Core\PlayerHistory
  • Budabot\Core\PlayerHistoryManager
  • Budabot\Core\PlayerManager
  • Budabot\Core\Preferences
  • Budabot\Core\PrivateChannelCommandReply
  • Budabot\Core\PrivateMessageCommandReply
  • Budabot\Core\Registry
  • Budabot\Core\SettingHandler
  • Budabot\Core\SettingManager
  • Budabot\Core\SettingObject
  • Budabot\Core\SocketManager
  • Budabot\Core\SocketNotifier
  • Budabot\Core\SubcommandManager
  • Budabot\Core\Text
  • Budabot\Core\TextSettingHandler
  • Budabot\Core\Timer
  • Budabot\Core\TimerEvent
  • Budabot\Core\TimeSettingHandler
  • Budabot\Core\Util
  • Budabot\Core\xml
  • Budabot\User\Modules\AlienArmorController
  • Budabot\User\Modules\AlienBioController
  • Budabot\User\Modules\AlienMiscController
  • Budabot\User\Modules\AOSpeakController
  • Budabot\User\Modules\AOUController
  • Budabot\User\Modules\AXPController
  • Budabot\User\Modules\BankController
  • Budabot\User\Modules\BosslootController
  • Budabot\User\Modules\BroadcastController
  • Budabot\User\Modules\BuffPerksController
  • Budabot\User\Modules\CacheController
  • Budabot\User\Modules\ChatAssistController
  • Budabot\User\Modules\ChatCheckController
  • Budabot\User\Modules\ChatLeaderController
  • Budabot\User\Modules\ChatRallyController
  • Budabot\User\Modules\ChatSayController
  • Budabot\User\Modules\ChatTopicController
  • Budabot\User\Modules\CityWaveController
  • Budabot\User\Modules\CloakController
  • Budabot\User\Modules\ClusterController
  • Budabot\User\Modules\CountdownController
  • Budabot\User\Modules\DevController
  • Budabot\User\Modules\DingController
  • Budabot\User\Modules\EventsController
  • Budabot\User\Modules\FightController
  • Budabot\User\Modules\FindOrgController
  • Budabot\User\Modules\FindPlayerController
  • Budabot\User\Modules\FunController
  • Budabot\User\Modules\GitController
  • Budabot\User\Modules\GuideController
  • Budabot\User\Modules\GuildController
  • Budabot\User\Modules\HelpbotController
  • Budabot\User\Modules\HtmlDecodeController
  • Budabot\User\Modules\ImplantController
  • Budabot\User\Modules\ImplantDesignerController
  • Budabot\User\Modules\InactiveMemberController
  • Budabot\User\Modules\ItemsController
  • Budabot\User\Modules\KillOnSightController
  • Budabot\User\Modules\LevelController
  • Budabot\User\Modules\LinksController
  • Budabot\User\Modules\LootListsController
  • Budabot\User\Modules\MdbController
  • Budabot\User\Modules\MessageInfoCommandReply
  • Budabot\User\Modules\MockCommandReply
  • Budabot\User\Modules\NanoController
  • Budabot\User\Modules\NewsController
  • Budabot\User\Modules\NotesController
  • Budabot\User\Modules\OnlineController
  • Budabot\User\Modules\OrgHistoryController
  • Budabot\User\Modules\OrglistController
  • Budabot\User\Modules\OrgMembersController
  • Budabot\User\Modules\OSController
  • Budabot\User\Modules\PlayerHistoryController
  • Budabot\User\Modules\PlayfieldController
  • Budabot\User\Modules\PocketbossController
  • Budabot\User\Modules\PremadeImplantController
  • Budabot\User\Modules\PrivateChannelController
  • Budabot\User\Modules\QuoteController
  • Budabot\User\Modules\RaffleController
  • Budabot\User\Modules\RaidController
  • Budabot\User\Modules\RandomController
  • Budabot\User\Modules\RecipeController
  • Budabot\User\Modules\RelayController
  • Budabot\User\Modules\ReputationController
  • Budabot\User\Modules\ResearchController
  • Budabot\User\Modules\RunAsController
  • Budabot\User\Modules\SendTellController
  • Budabot\User\Modules\ShoppingController
  • Budabot\User\Modules\SilenceController
  • Budabot\User\Modules\SkillsController
  • Budabot\User\Modules\SpiritsController
  • Budabot\User\Modules\StopwatchController
  • Budabot\User\Modules\Teamspeak3
  • Budabot\User\Modules\TeamspeakController
  • Budabot\User\Modules\TestController
  • Budabot\User\Modules\TimeController
  • Budabot\User\Modules\TimerController
  • Budabot\User\Modules\TimezoneController
  • Budabot\User\Modules\TowerController
  • Budabot\User\Modules\TrackerController
  • Budabot\User\Modules\TrickleController
  • Budabot\User\Modules\UnixtimeController
  • Budabot\User\Modules\VoteController
  • Budabot\User\Modules\WeatherController
  • Budabot\User\Modules\WhatBuffsController
  • Budabot\User\Modules\WhereisController
  • Budabot\User\Modules\WhoisController
  • Budabot\User\Modules\WhoisOrgController
  • Budabot\User\Modules\WhompahController
  • Command
  • DefaultStatus
  • DefineCommand
  • Description
  • Event
  • HandlesCommand
  • Help
  • Inject
  • Instance
  • Intoptions
  • Matches
  • Options
  • Setting
  • Setup
  • Type
  • Tyrence\Modules\DemoResponseCommandReply
  • Tyrence\Modules\SameChannelResponseController
  • Visibility

Interfaces

  • Budabot\Core\CommandReply

Exceptions

  • Budabot\Core\InvalidHttpRequest
  • Budabot\Core\SQLException
  • Budabot\Core\StopExecutionException

Functions

  • Budabot\Core\isWindows
  • Budabot\Core\Modules\read_input
  • Overview
  • Namespace
  • Class
  1: <?php
  2: 
  3: namespace Budabot\User\Modules;
  4: 
  5: use Budabot\Core\AutoInject;
  6: 
  7: /**
  8:  * Authors: 
  9:  *  - Tyrence (RK2)
 10:  *
 11:  * @Instance
 12:  *
 13:  * Commands this class contains:
 14:  *  @DefineCommand(
 15:  *      command     = 'git',
 16:  *      accessLevel = 'admin',
 17:  *      description = 'Updates bot from Git repository',
 18:  *      help        = 'git.txt'
 19:  *  )
 20:  */
 21: class GitController extends AutoInject {
 22: 
 23:     /**
 24:      * Name of the module.
 25:      * Set automatically by module loader.
 26:      */
 27:     public $moduleName;
 28:     
 29:     /** @Setup */
 30:     public function setup() {
 31:         $this->settingManager->add($this->moduleName, "gitpath", "Path to git binary", "edit", "text", "git", "git;/usr/bin/git;C:/Program Files (x86)/Git/bin/git.exe");
 32:     }
 33:     
 34:     /**
 35:      * @HandlesCommand("git")
 36:      * @Matches("/^git incoming$/i")
 37:      */
 38:     public function gitIncomingCommand($message, $channel, $sender, $sendto, $args) {
 39:         $gitpath = $this->settingManager->get('gitpath');
 40:         $command = "$gitpath fetch origin 2>&1";
 41:         $this->executeCommand($command);
 42:         
 43:         $command = "$gitpath log master ...origin/master 2>&1";
 44:         
 45:         $blob = $this->executeCommand($command);
 46:         $msg = $this->text->makeBlob("git incoming", $blob);
 47:         $sendto->reply($msg);
 48:     }
 49:     
 50:     /**
 51:      * @HandlesCommand("git")
 52:      * @Matches("/^git diff$/i")
 53:      */
 54:     public function gitDiffCommand($message, $channel, $sender, $sendto, $args) {
 55:         $gitpath = $this->settingManager->get('gitpath');
 56:         $command = "$gitpath fetch origin 2>&1";
 57:         $this->executeCommand($command);
 58:         
 59:         $command = "$gitpath diff --stat HEAD ...origin/master 2>&1";
 60:         
 61:         $blob = $this->executeCommand($command);
 62:         $msg = $this->text->makeBlob("git diff", $blob);
 63:         $sendto->reply($msg);
 64:     }
 65: 
 66:     /**
 67:      * @HandlesCommand("git")
 68:      * @Matches("/^git pull$/i")
 69:      */
 70:     public function gitPullCommand($message, $channel, $sender, $sendto, $args) {
 71:         $gitpath = $this->settingManager->get('gitpath');
 72:         $command = "$gitpath pull origin master 2>&1";
 73:         
 74:         $blob = $this->executeCommand($command);
 75:         $msg = $this->text->makeBlob("git pull", $blob);
 76:         $sendto->reply($msg);
 77:     }
 78:     
 79:     /**
 80:      * @HandlesCommand("git")
 81:      * @Matches("/^git log$/i")
 82:      */
 83:     public function gitLogCommand($message, $channel, $sender, $sendto, $args) {
 84:         $gitpath = $this->settingManager->get('gitpath');
 85:         $command = "$gitpath log -n 20 2>&1";
 86:         
 87:         $blob = $this->executeCommand($command);
 88:         $msg = $this->text->makeBlob("git log", $blob);
 89:         $sendto->reply($msg);
 90:     }
 91:     
 92:     /**
 93:      * @HandlesCommand("git")
 94:      * @Matches("/^git status$/i")
 95:      */
 96:     public function gitStatusCommand($message, $channel, $sender, $sendto, $args) {
 97:         $gitpath = $this->settingManager->get('gitpath');
 98:         $command = "$gitpath status 2>&1";
 99:         
100:         $blob = $this->executeCommand($command);
101:         $msg = $this->text->makeBlob("git status", $blob);
102:         $sendto->reply($msg);
103:     }
104:     
105:     private function executeCommand($command) {
106:         $output = array();
107:         $return_var = '';
108:         exec($command, $output, $return_var);
109: 
110:         $blob = $command . "\n\n";
111:         $blob .= implode("\n", $output);
112:         return $blob;
113:     }
114: }
115: 
Budabot 4 Docs API documentation generated by ApiGen