Oldes / Rebol-IRC

Rebol IRC module

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Rebol-IRC CI

Rebol/IRC

Rebol IRC scheme for Rebol3.

Basic usage example

This is minimal code, which does not handles reconnection and has almost no command handlers.

import %irc.reb
port: make port! [
    scheme:  'irc
    user:    "MyReBot"
    real:    "My Full Name"
    host:    "irc.libera.chat"
    commands: make map! reduce/no-set [
        PRIVMSG: func[ircp cmd][ print ["PRIVMSG:" mold cmd] ]
        001      func[ircp cmd][ print "You are connected now!" ]
    ]
]
open port                     ;; Initialize the connection
forever [
    res: wait [port 30]       ;; Wakeup after every 30 seconds
    unless open? port [break] ;; Connection was lost, so exit the loop
    unless res [
        write port 'PING      ;; Send PING to server
    ]
]

For more complex example see: irc-test.r3

About

Rebol IRC module


Languages

Language:Rebol 100.0%