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();
});