Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Net::IRC print multiple lines from $self->privmsg

by jfroebe (Parson)
on Nov 19, 2004 at 16:37 UTC ( [id://409043]=perlquestion: print w/replies, xml ) Need Help??

jfroebe has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

Does anyone know how to print multiple lines in an IRC message without sending multiple messages?

Example (what I want)

09:00 _TESTBOT Are you posting in the right place?
Check out Where should I post X? to know for sure.

Example (what I don't want)

09:00 _TESTBOT Are you posting in the right place?
09:00 _TESTBOT Check out Where should I post X? to know for sure.

Putting /n or /r/n or /n/r in the $self->privmsg truncates the message at the first newline. I know it is something simple that I'm over looking..

Searching on PM and Google points to just sending multiple messages... but this is not always desirable. Take for example a simple "/help" command.. which is easier to read?

09:00 _TESTBOT help
/help this help screen
/ping <server>
Check if Sybase Server is alive
/checkbackup <server>
Report the begin and end of

OR

09:00 _TESTBOT help
09:00 _TESTBOT /help this help screen
09:00 _TESTBOT /ping <server>
09:00 _TESTBOT Check if Sybase Server is alive
09:00 _TESTBOT /checkbackup <server>
09:00 _TESTBOT Report the begin and end of

database backups

Jason L. Froebe

Team Sybase member

No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

  • Comment on Net::IRC print multiple lines from $self->privmsg

Replies are listed 'Best First'.
Re: Net::IRC print multiple lines from $self->privmsg
by lithron (Chaplain) on Nov 19, 2004 at 17:05 UTC
    I hate being a nay-sayer, but I'm not sure its a legal thing to do on IRC, even if it is possible. RFC 1459 section 2.3 : "There is no provision for continuation message lines."

      thanks!

      Hmm... that's what I was afraid of that it might be an extension to certain IRC clients. (much like color).

      Jason L. Froebe

      Team Sybase member

      No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

Re: Net::IRC print multiple lines from $self->privmsg
by Corion (Patriarch) on Nov 19, 2004 at 17:06 UTC

    IRC is a line oriented protocol, so I really doubt that there is a way to put multiple lines into one line. Also, there are (various) length limits on a single line to prevent flooding. So I guess you're out of luck, unless your program splits up a single line into multiple lines before sending the line.

      As I recall there might be a way by putting a semi-colon (Update: I think I meant a colon) and then your string at the end of the command but it has been a long time since I've read the RFC and I do recall that commands are terminated by the '\n' character. Let us know if you do figure it out though. :^)
Re: Net::IRC print multiple lines from $self->privmsg
by DaWolf (Curate) on Nov 19, 2004 at 20:20 UTC
    I've made a perl IRC bot with a help command and I had to use multiple messages.

    If your main concern is flood protection you might consider putting a small interval between them, altought in my case it wasn't necessary...

    Update:

    Considering your example of /help, I personally think the second one is better to read, since the bot nickname makes all the important stuff to be "indented" (in lack of a better term).

    Best regards,
Re: Net::IRC print multiple lines from $self->privmsg
by jfroebe (Parson) on Nov 19, 2004 at 22:01 UTC

    Randal Schwartz wrote a related but somewhat convoluted Perl Journal article

    Jason L. Froebe

    Team Sybase member

    No one has seen what you have seen, and until that happens, we're all going to think that you're nuts. - Jack O'Neil, Stargate SG-1

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://409043]
Approved by elwarren
Front-paged by elwarren
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-25 10:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found