Chatbot - Reply with username?

104 views
Skip to first unread message

Dominik Günder

unread,
Jun 2, 2016, 7:50:48 AM6/2/16
to AJAX-chat
Hello there,


I have changed the string for the bot to posting the replys into the current channel and not as a private Message to the user like this:

if(stristr($text, '!name')) {
// KEYWORDS TRIGGER START
    $this->insertChatBotMessage(
"Hello! You can change the nickname by using the command /nick NEWNAME."
);
}

Is there any possibility to add the usersname of the user, that entered the trigger? Like:

"Hello, $userName, you can change the nickname by using the command /nick NEWNAME."

Would be great to hear from you :)

Thanks in advance

Dominik Günder

unread,
Jun 2, 2016, 2:21:31 PM6/2/16
to AJAX-chat
Hello there,

i found out by myself. Sometimes it is super simple... :)

For all of you, that want to use this mod by the same way just use this code:

if(stristr($text, '!name')) {
// KEYWORDS TRIGGER START
$text = 'Hallo '.$this->getUserName() .', you can change the nickname by using the command /nick NEWNAME.';
    $this->insertChatBotMessage(
$this->getChannel(),
$text
);
Reply all
Reply to author
Forward
0 new messages