Code: Select all
namespace eval friendInvite {
set ison(friends) {"friend_1" "friend_2"}
set ison(channels) {"#channel" "#anotherChannel"}
bind cron - {*/5} [namespace current]::check
bind raw - 303 [namespace current]::reply
proc reply {from keyword text} {
variable ison
set friend [join [lindex [split $text :] 1]]
if {$friend ne ""} {
foreach chan $ison(channels) {
if {[botonchan $chan]} {
puthelp "INVITE $friend $chan"
}
}
}
}
proc check {min hour day month weekday} {
variable ison
foreach friend $ison(friends) {
if {[getchanhost $friend] ne ""} {
foreach chan $ison(channels) {
if {![botisop $chan]} continue
if {[onchan $friend $chan]} continue
puthelp "INVITE $friend $chan"
}
} else {
puthelp "ISON $friend"
}
}
}
}
Code: Select all
namespace eval friendInvite {
set ison(friends) {"friend_1" "friend_2"}
set ison(channels) {"#channel" "#anotherChannel"}
bind raw - 303 [namespace current]::reply
bind evnt - init-server [namespace current]::check
proc reply {from keyword text} {
variable ison
set friend [join [lindex [split $text :] 1]]
if {$friend eq ""} return
if {[lsearch -nocase $ison(friends) $friend] eq -1} return
foreach chan $ison(channels) {
if {[botonchan $chan]} {
puthelp "INVITE $friend $chan"
}
}
}
proc connected init-server {
variable ison
foreach friend $ison(friends) {
puthelp "ISON $friend"
}
}
}
Code: Select all
# April 20, 2015
# http://forum.egghelp.org/viewtopic.php?t=19934
# the poster is asking to make something similar to mIRC's built in "notify" list
# mIRC uses the IRC server's /watch command or the /monitor command
# Usage:
# To temporarily add a nick to the watch list:
# !addwatch <nick>
# To temporarily remove a nick from the watch list:
# !remwatch <nick>
# To display the current watch list:
# !watchlist
# You must create a plain text file, with one nick per line
# This file will be read by the bot upon .restart and the nicks in it
# will be added to the watch list held by the IRC server for this session.
#set the path/filename of file that holds the nicks to watch (Required)
set nicks_watch_file "scripts/added/use_irc_watch/nicks_watch_file.txt"
#set channel where you can experiment and demonstrate this script (Required - and bot must be on this channel)
set your_demo_chan #eggdrop
##########################################################################
##########################################################################
bind pub - "!addwatch" add_to_watchlist
bind pub - "!remwatch" remove_from_watchlist
bind pub - "!watchlist" get_watch_stats
bind raw - 600 rpl_logon
bind raw - 601 rpl_logoff
bind raw - 606 rpl_watchlist
#Reference : https://www.alien.net.au/irc/irc2numerics.html
######### to read the nicks to watch, and send them to the IRC server
proc send_watch_command {nicks_watch_file} {
if {![file exists $nicks_watch_file]} {
putlog " "
putlog "$nicks_watch_file not found !"
putlog " "
return 0
}
set fp [open $nicks_watch_file "r"]
set data [read -nonewline $fp]
close $fp
set lines [split $data "\n"]
foreach n $lines {
puthelp "watch +$n"
}
putlog "Added these nicks to watch list on IRC server : $lines"
}
proc rpl_logon {from key text } {
global your_demo_chan
#putserv "privmsg $your_demo_chan :$from $key $text"
putserv "privmsg $your_demo_chan :[lindex [split $text] 1 ] has logged on "
putserv "invite [lindex [split $text] 1] $your_demo_chan "
}
proc rpl_logoff {from key text} {
global your_demo_chan
#putserv "privmsg $your_demo_chan :$from $key $text"
putserv "privmsg $your_demo_chan :[lindex [split $text] 1 ] has logged off"
}
proc rpl_watchlist {from key text} {
global your_demo_chan
putserv "privmsg $your_demo_chan :Watch list of nicks is currently: [lindex [split $text :] 1]"
}
proc add_to_watchlist {nick uhost handle chan text} {
putserv "watch +[lindex [split $text] 0 ]"
putserv "privmsg $chan :[lindex [split $text] 0 ] temporarily added to watch list"
putserv "privmsg $chan :Edit the watch list file, to make it permanent for next restart of bot"
}
proc remove_from_watchlist {nick uhost handle chan text} {
putserv "watch -[lindex [split $text] 0 ]"
putserv "privmsg $chan :[lindex [split $text] 0 ] temporarily removed from watch list"
putserv "privmsg $chan :Edit the watch list file, to permanently remove for next restart of bot"
}
proc get_watch_stats {nick uhost handle chan text} {
putserv "watch stat"
}
######### read the nicks to watch, and send them to the IRC server
bind evnt - init-server do_watch_command_wrap
proc do_watch_command_wrap {type} {
global nicks_watch_file
send_watch_command $nicks_watch_file
}
#########
Network: chathispanowillyw wrote:juanamores:
What network is your bot on?
and what is the address?
Yes, I want to keep monitoring when one of the friends in the list disconnected and reconnected and invite once, and if possible, if someone after being invited changing nick, and then returns to nick that is listed, re-invite too.caesar wrote: Or you want it to keep monitoring when one of the friends in the list disconnected and reconnected and invite once?
Excellent!juanamores wrote: ...
Only I have to modify it to suit my needs.
Visit here:The changes I plan are:
a) that adding a user to the list, modify the txt file, in this code must be modified manually.
b) also that deleting a user, it modify the file.
Have fun with your bot, and with writing your own TCL for it!c) not invite all users to the same channel, but depending on your flag, the invite to the channel concerned.
Some users will be invited to all channels of staff, others just one.
I think this got work to go editing.