3 namespace App\DiscordBotCommands;
5 use App\Models\DiscordBotCommand;
7 use Discord\Parts\User\Activity;
8 use React\Promise\Promise;
10 class PresenceCommand extends BaseCommand {
12 public function __construct(Discord $discord, DiscordBotCommand $cmd) {
13 parent::__construct($discord, $cmd);
16 public function execute() {
17 return new Promise(function($resolve) {
22 if ($this->hasParameter('activity')) {
23 $activity = new Activity($this->discord);
24 $activity->type = $this->getParameter('activity');
25 if ($this->hasParameter('name')) {
26 $activity->name = $this->getParameter('name');
28 if ($this->hasParameter('url')) {
29 $activity->url = $this->getParameter('url');
32 if ($this->hasParameter('idle')) {
33 $idle = $this->parameters['idle'];
35 if ($this->hasParameter('status')) {
36 $status = $this->getParameter('status');
38 if ($this->hasParameter('afk')) {
39 $afk = $this->getParameter('afk');
41 $this->discord->updatePresence($activity, $idle, $status, $afk);