DEV Community

mascalzone
mascalzone

Posted on

TCL for eggdrop IRC bot SPY chan to chan

I recommend you don't run this script on a bot that already has to do alot
If the channel you're spying on has alot of users with alot of talking your bot could excess flood

`# Info
# Author : AkTaRuS - #SiamoSoloNoi on IRCserveR Italia https://www.ircwebnet.com/chat
# Version: 007.TCL 1.1
set spy(author)  "AkTaRuS - #SiamoSoloNoi on IRCserveR Italia https://www.ircwebnet.com/chat"
set spy(version) " OO7.tcl 1.1"

# Description

# This script will relay anything said on one channel to the other channel you configure
# I recommend you don't run this script on a bot that already has to do alot
# If the channel you're spying on has alot of users with alot of talking your bot could excess flood

# Configuration

# The channel it reports everything to
set spy(home) "#siamosolonoi"

# The channel it gets all the data from and then reports it to the homechannel
set spy(chan) "#canale spiato"

bind PUBM   -|- *                spychan:chat
bind CTCP   -|- "ACTION"         spychan:action
bind SIGN   -|- "$spy(chan) *"   spychan:sign
bind JOIN   -|- "$spy(chan) *"   spychan:join
bind PART   -|- "$spy(chan) *"   spychan:part
bind SPLT   -|- "$spy(chan) *"   spychan:split
bind KICK   -|- "$spy(chan) *"   spychan:kick
bind RAW     *  "MODE"           spychan:mode

proc spychan:part { nickname hostname handle channel reason } {
    global spy
    if {[string equal -nocase $channel $spy(chan)]} {
    putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname ($hostname) has left $spy(chan)"
    }
       }

proc spychan:join { nickname hostname handle channel } {
    global spy
    if {[string equal -nocase $channel $spy(chan)]} {
    putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname ($hostname) has joined $spy(chan)"
    }
       }

proc spychan:kick { nickname hostname handle channel target reason } {
    global spy
    if {[string equal -nocase $channel $spy(chan)]} {
    putserv "PRIVMSG $spy(home) :\[$channel\] * $target was kicked from $spy(chan) by $nickname ($reason)"
    }
       }

proc spychan:mode { from key arguments } {
    global spy
    set channel [string trim [lindex [split $arguments] 0]] 
    set modechange [string trim [lindex [split $arguments] 1]] 
    set victims [string trim [join [lrange [split $arguments] 2 end]]] 

    set nickname [string trim [lindex [split $from "!"] 0]] 
    set hostname [string trim [lindex [split $from "!"] 1]]
    if {[string equal -nocase $channel $spy(chan)]} {
    putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname sets mode: $modechange $victims"
    }
       }

proc spychan:sign { nickname hostname handle channel reason } {
    global spy
    if {[string equal -nocase $channel $spy(chan)]} {
    putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname ($hostname) has quit IRC ($reason)"
    }
       }

proc spychan:split { nickname hostname handle channel arguments } {
    global spy
    if {[string equal -nocase $channel $spy(chan)]} {
    putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname has split from the network"
    }
       }

proc spychan:chat { nickname hostname handle channel arguments } {
    global spy
    if {[string equal -nocase $channel $spy(chan)]} {
        putserv "PRIVMSG $spy(home) :$arguments"
        }
       }

proc spychan:action { nickname hostname handle channel keyword arguments } {
    global spy
    if {[string equal -nocase $channel $spy(chan)]} {
        putserv "PRIVMSG $spy(home) :\[$channel\] * $nickname $arguments"
        }
       }

putlog "OO7.tcl version $spy(version) by $spy(author)  Loaded!"`
Enter fullscreen mode Exit fullscreen mode

Click here for clarification on how to install a TCL on eggdrop

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

Instrument, monitor, fix: a hands-on debugging session

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

Tune in to the full event

DEV is partnering to bring live events to the community. Join us or dismiss this billboard if you're not interested. ❤️