1: <?php
2:
3: namespace Budabot\User\Modules;
4:
5: use Budabot\Core\AutoInject;
6:
7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20:
21: class RunAsController extends AutoInject {
22:
23: 24: 25: 26:
27: public $moduleName;
28:
29: 30: 31:
32: public function setup() {
33:
34: }
35:
36: 37: 38: 39:
40: public function runasCommand($message, $channel, $sender, $sendto, $args) {
41: $name = ucfirst(strtolower($args[1]));
42: $command = $args[2];
43: if ($this->accessManager->checkAccess($sender, "superadmin") || $this->accessManager->compareCharacterAccessLevels($sender, $name) > 0) {
44: $this->commandManager->process($channel, $command, $name, $sendto);
45: } else {
46: $sendto->reply("Error! Access level not sufficient to run commands as <highlight>$name<end>.");
47: }
48: }
49: }
50: