| View previous topic :: View next topic |
| Author |
Message |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Sun Apr 19, 2015 11:36 pm Post subject: invite a user list when users connect server |
|
|
In mSL (mIRC script language) exists a list called notify. See
The notify list is like a buddy list, it notifies you when someone in your list comes on or leaves the IRC network that you are on.
I made a code in mSL, which invites a specific channels, notify list users.
When any user found in the guest list, connects to an IRC server, the bot invites the established channels.
You can achieve this in Tcl? _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Mon Apr 20, 2015 12:15 am Post subject: |
|
|
I'm fairly sure that anything that can be done in MSL can also be pulled off in Eggdrop TCL.
So the answer to "You can achieve this in Tcl?" is Yes.
Have you searched the internet for a script like that yet? _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Apr 20, 2015 1:40 am Post subject: |
|
|
If the IRC server you are connected to supports ISON then can use this to achieve what you want. On Undernet the result of a ISON will be a raw 303 reply. On what network are you connected?
On Undernet using the raw 303 I got this up and running:
| Code: |
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"
}
}
}
}
|
It dose a check every 5 minutes, but if needed can be adjusted to whatever suits your needs. mIRC dose a ISON check only when you access the notify list or hit /notify on your own. _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Mon Apr 20, 2015 12:46 pm Post subject: |
|
|
caesar you are a genius!
Works very well
The difference I noticed with mIRC, is that mIRC invites only once at user, when connecting to the network, or if after connecting changing nick, and then return to the original nickname, contained in notification list, in this case again invites.
In the code you have shared with me, inviting the same user indefinitely every x minutes.
Can you fix the code, to invite a user only once, when connected to the network, and then re-invite if you leave the network and enter again or if being on the net the nick is changed, then return to the nick is on the notification list? _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|
| Back to top |
|
 |
caesar Mint Rubber

Joined: 14 Oct 2001 Posts: 3741 Location: Mint Factory
|
Posted: Mon Apr 20, 2015 1:27 pm Post subject: |
|
|
Sure, here's the new code.
| Code: |
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"
}
}
}
|
It will check the friends list only once after it connected to the IRC network. Is this what you wanted? Or you want it to keep monitoring when one of the friends in the list disconnected and reconnected and invite once? _________________ Once the game is over, the king and the pawn go back in the same box. |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Mon Apr 20, 2015 1:38 pm Post subject: |
|
|
This is very rough. There are a lot of things that can be done with it, to improve it.
It's purpose is only to demonstrate the idea, as this is what I think the original poster is asking for.
He is used to using the IRC servers built-in "watch" or "monitor" command, and I think these are handled transparently by mIRC.
They provide instant notification, when a nick appears or disappears on the network.
That is part of the problem with this kind of script. It may need to be
customized for the particular network that it is to be used on.
This script works on the one network that I tested it on.
One would benefit from using:
/debug @debugwindow
in mIRC, then experimenting with sending
/notify
and also its variants with switches. Then watch for the raw numerics returned.
| Code: |
# 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
}
#########
|
_________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Mon Apr 20, 2015 1:50 pm Post subject: |
|
|
juanamores:
What network is your bot on?
and what is the address? _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Mon Apr 20, 2015 2:44 pm Post subject: |
|
|
| willyw wrote: | juanamores:
What network is your bot on?
and what is the address? |
Network: chathispano
Adress: irc.irc-hispano.org
this adress connect to miranda.chathispano.com or ariel.chathispano.com
In a while I'll try the code you have shared.
Now I am testing the caesarīs code.
Very grateful for your interest my friend.  _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|
| Back to top |
|
 |
juanamores Master
Joined: 15 Mar 2015 Posts: 317
|
Posted: Mon Apr 20, 2015 3:13 pm Post subject: |
|
|
| caesar wrote: |
Or you want it to keep monitoring when one of the friends in the list disconnected and reconnected and invite once? |
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.
EDIT:
Dear caesar, code shared with willyw does exactly what I want.
Only I have to modify it to suit my needs.
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.
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.
Very grateful to caesar and willyw for their important help.  _________________ If you do not understand my ideas is because I can not think in English, I help me with Google Translate. I only speak Spanish. Bear with me. Thanks  |
|
| Back to top |
|
 |
willyw Revered One
Joined: 15 Jan 2009 Posts: 1175
|
Posted: Mon Apr 20, 2015 5:45 pm Post subject: |
|
|
| juanamores wrote: |
...
Only I have to modify it to suit my needs.
|
Excellent!
It wasn't meant to be all finished.
I'm glad if you can use it enough to get started and modify it to your needs.
| Quote: |
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.
|
Visit here:
http://forum.egghelp.org/viewtopic.php?t=6885
and you might find some info that is helpful with that.
| Quote: |
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.
|
Have fun with your bot, and with writing your own TCL for it!
 _________________ For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia ! |
|
| Back to top |
|
 |
|