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: /**
  6:  * @Instance
  7:  *
  8:  * Commands this controller contains:
  9:  *  @DefineCommand(
 10:  *      command     = 'topic', 
 11:  *      accessLevel = 'all', 
 12:  *      description = 'Shows Topic', 
 13:  *      help        = 'topic.txt'
 14:  *  )
 15:  *  @DefineCommand(
 16:  *      command     = 'topic .+', 
 17:  *      accessLevel = 'rl', 
 18:  *      description = 'Changes Topic', 
 19:  *      help        = 'topic.txt'
 20:  *  )
 21:  */
 22: class ChatTopicController {
 23: 
 24:     /**
 25:      * Name of the module.
 26:      * Set automatically by module loader.
 27:      */
 28:     public $moduleName;
 29:     
 30:     /** @Inject */
 31:     public $chatBot;
 32:     
 33:     /** @Inject */
 34:     public $settingManager;
 35:     
 36:     /** @Inject */
 37:     public $util;
 38:     
 39:     /** @Inject */
 40:     public $chatRallyController;
 41: 
 42:     /** @Inject */
 43:     public $chatLeaderController;
 44: 
 45:     /**
 46:      * @Setting("topic")
 47:      * @Description("Topic for Priv Channel")
 48:      * @Visibility("noedit")
 49:      * @Type("text")
 50:      */
 51:     public $defaultTopic = '';
 52: 
 53:     /**
 54:      * @Setting("topic_setby")
 55:      * @Description("Character who set the topic")
 56:      * @Visibility("noedit")
 57:      * @Type("text")
 58:      */
 59:     public $defaultTopicSetBy = '';
 60: 
 61:     /**
 62:      * @Setting("topic_time")
 63:      * @Description("Time the topic was set")
 64:      * @Visibility("noedit")
 65:      * @Type("text")
 66:      */
 67:     public $defaultTopicTime = '';
 68: 
 69:     /**
 70:      * This command handler shows topic.
 71:      * @HandlesCommand("topic")
 72:      * @Matches("/^topic$/i")
 73:      */
 74:     public function topicCommand($message, $channel, $sender, $sendto, $args) {
 75:         if ($this->settingManager->get('topic') == '') {
 76:             $msg = 'No topic set.';
 77:         } else {
 78:             $msg = $this->buildTopicMessage();
 79:         }
 80: 
 81:         $sendto->reply($msg);
 82:     }
 83: 
 84:     /**
 85:      * This command handler clears topic.
 86:      * @HandlesCommand("topic .+")
 87:      * @Matches("/^topic clear$/i")
 88:      */
 89:     public function topicClearCommand($message, $channel, $sender, $sendto, $args) {
 90:         if (!$this->chatLeaderController->checkLeaderAccess($sender)) {
 91:             $sendto->reply("You must be Raid Leader to use this command.");
 92:             return;
 93:         }
 94: 
 95:         $this->setTopic($sender, "");
 96:         $msg = "Topic has been cleared.";
 97:         $sendto->reply($msg);
 98:     }
 99: 
100:     /**
101:      * This command handler sets topic.
102:      * @HandlesCommand("topic .+")
103:      * @Matches("/^topic (.+)$/i")
104:      */
105:     public function topicSetCommand($message, $channel, $sender, $sendto, $args) {
106:         if (!$this->chatLeaderController->checkLeaderAccess($sender)) {
107:             $sendto->reply("You must be Raid Leader to use this command.");
108:             return;
109:         }
110: 
111:         $this->setTopic($sender, $args[1]);
112:         $msg = "Topic has been updated.";
113:         $sendto->reply($msg);
114:     }
115: 
116:     /**
117:      * @Event("logOn")
118:      * @Description("Shows topic on logon of members")
119:      */
120:     public function logonEvent($eventObj) {
121:         if ($this->settingManager->get('topic') == '') {
122:             return;
123:         }
124:         if (isset($this->chatBot->guildmembers[$eventObj->sender]) && $this->chatBot->isReady()) {
125:             $msg = $this->buildTopicMessage();
126:             $this->chatBot->sendTell($msg, $eventObj->sender);
127:         }
128:     }
129: 
130:     /**
131:      * @Event("joinPriv")
132:      * @Description("Shows topic when someone joins the private channel")
133:      */
134:     public function joinPrivEvent($eventObj) {
135:         if ($this->settingManager->get('topic') == '') {
136:             return;
137:         }
138:         $msg = $this->buildTopicMessage();
139:         $this->chatBot->sendTell($msg, $eventObj->sender);
140:     }
141:     
142:     public function setTopic($name, $msg) {
143:         $this->settingManager->save("topic_time", time());
144:         $this->settingManager->save("topic_setby", $name);
145:         $this->settingManager->save("topic", $msg);
146: 
147:         if (empty($msg)) {
148:             $this->chatRallyController->clear();
149:         }
150:     }
151: 
152:     /**
153:      * Builds current topic information message and returns it.
154:      */
155:     public function buildTopicMessage() {
156:         $date_string = $this->util->unixtimeToReadable(time() - $this->settingManager->get('topic_time'), false);
157:         $topic = $this->settingManager->get('topic');
158:         $set_by = $this->settingManager->get('topic_setby');
159:         $msg = "Topic: <highlight>{$topic}<end> [set by <highlight>{$set_by}<end>][<highlight>{$date_string} ago<end>]";
160:         return $msg;
161:     }
162: }
163: 
Budabot 4 Docs API documentation generated by ApiGen