When creating a perlmodule I would like to trigger a message back to the channel, but for some reason the PutUser is displayed BEFORE the message which triggered the function itself. I developed a hack to get around that (since PutIRC does not display on the user hosting the script) but it involves printing the triggering message manually, then sending a HALTCORE back to znc.
I have attached the function, but perhaps I am just doing something wrong. If this is the intended functionality then sorry for bothering you!
subOnChanMsg{my$self=shift;my($nick,$chan,$msg)=@_;if($chan->GetNameeq"#vong"){#log to module.#$self->PutModule("Hey, ".$nick->GetNick." said [$msg] on ".$chan->GetName);my$replyString="Channel: ".$chan->GetName." , Message: ".$msg." , Nick: ".$nick->GetNick." , Hosted by ".$varrrr;#$self->GetUser->GetNick; # user account$self->PutIRC("PRIVMSG ".$chan->GetName." :".$replyString);#send the reply to the user's query$self->PutUser(":".$nick->GetNick." PRIVMSG ".$chan->GetName." :".$msg);#print the users message locally$self->PutUser(":".$self->GetNetwork->GetCurNick."* PRIVMSG ".$chan->GetName." :".$replyString);#then the reply locallyreturn$ZNC::HALTCORE;#and tell ZNC not to post the message, as I did already If you dont do it this way it will put the reply before the message#return $ZNC::CONTINUE;}else{return$ZNC::CONTINUE;}}
When creating a perlmodule I would like to trigger a message back to the channel, but for some reason the PutUser is displayed BEFORE the message which triggered the function itself. I developed a hack to get around that (since PutIRC does not display on the user hosting the script) but it involves printing the triggering message manually, then sending a HALTCORE back to znc.
I have attached the function, but perhaps I am just doing something wrong. If this is the intended functionality then sorry for bothering you!
``` perl
sub OnChanMsg {
my $self = shift;
my ($nick, $chan, $msg) = @_;
if($chan->GetName eq "#vong"){
#log to module.
#$self->PutModule("Hey, ".$nick->GetNick." said [$msg] on ".$chan->GetName);
my $replyString="Channel: ".$chan->GetName." , Message: ".$msg." , Nick: ".$nick->GetNick." , Hosted by ".$varrrr;
#$self->GetUser->GetNick; # user account
$self->PutIRC("PRIVMSG ".$chan->GetName." :".$replyString); #send the reply to the user's query
$self->PutUser(":".$nick->GetNick." PRIVMSG ".$chan->GetName." :".$msg); #print the users message locally
$self->PutUser(":".$self->GetNetwork->GetCurNick."* PRIVMSG ".$chan->GetName." :".$replyString); #then the reply locally
return $ZNC::HALTCORE; #and tell ZNC not to post the message, as I did already If you dont do it this way it will put the reply before the message
#return $ZNC::CONTINUE;
}else{
return $ZNC::CONTINUE;
}
}
```
<!-- github-sync-id:13846694 -->
This is expected behaviour, PutIRC goes to the server, PutUser goes to user's clients.
Feel free to ask questions about the API on #znc on freenode/efnet.
This is expected behaviour, PutIRC goes to the server, PutUser goes to user's clients.
Feel free to ask questions about the API on #znc on freenode/efnet.
<!-- github-comment-id:17283182 -->
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
When creating a perlmodule I would like to trigger a message back to the channel, but for some reason the PutUser is displayed BEFORE the message which triggered the function itself. I developed a hack to get around that (since PutIRC does not display on the user hosting the script) but it involves printing the triggering message manually, then sending a HALTCORE back to znc.
I have attached the function, but perhaps I am just doing something wrong. If this is the intended functionality then sorry for bothering you!
This is expected behaviour, PutIRC goes to the server, PutUser goes to user's clients.
Feel free to ask questions about the API on #znc on freenode/efnet.