X-Git-Url: https://git.localhorst.tv/?a=blobdiff_plain;f=app%2FTwitchBotCommands%2FRandomChatCommand.php;h=f3ee928e00fb3f063eadf5b6fce47e3997268269;hb=4b8475936f9c0f0379d2dee4e1440f4445682715;hp=cc49c00e62a788757ae267732d8680d59e344bd7;hpb=ebdf8e5f6761de2abd85b01096a67dee62d7d4aa;p=alttp.git diff --git a/app/TwitchBotCommands/RandomChatCommand.php b/app/TwitchBotCommands/RandomChatCommand.php index cc49c00..f3ee928 100644 --- a/app/TwitchBotCommands/RandomChatCommand.php +++ b/app/TwitchBotCommands/RandomChatCommand.php @@ -19,13 +19,16 @@ class RandomChatCommand extends BaseCommand { return new Promise(function($resolve) { $channel = Channel::findOrFail($this->getParameter('channel')); $text = $channel->randomOfClass($this->getParameter('category')); - $this->bot->sendIRCMessage(IRCMessage::privmsg($channel->twitch_chat, $text->text_content)); + $actual_text = is_object($text) ? $text->text_content : $text; + $this->bot->sendIRCMessage(IRCMessage::privmsg($channel->twitch_chat, $actual_text)); $log = new ChatBotLog(); $log->channel()->associate($channel); if (is_object($text)) { $log->origin()->associate($text); } - $log->text = $text->text_content; + $log->text = $actual_text; + $log->user()->associate($this->getExecutingUser()); + $log->category = $this->getParameter('category'); $log->save(); $resolve(); });