| View previous topic :: View next topic |
| Author |
Message |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Thu Sep 09, 2021 1:13 am Post subject: set mode on join |
|
|
i want to set samode both 2 channels +E when is match hostmask *.mibbit.com on join and to unset mode channels after 60 min
can someone help thx in advance
| Code: |
Joins: mib_ufoo9l (59d2ec67@Test-B3B25F2D.mibbit.com)
|
| Code: |
set chanban "#test1 #test2"
set checkdomain {"*.mibbit.com"}
set chanmode "E"
set timemode "60"
bind join - * banmibbit
proc banmibbit {nick host hand chan} {
global chanban checkdomain chanmode timemode
if {![chan gets $chanban] || [isbotnick $nick]} { return 0 }
foreach checkdomain $chanban {
if {[string match $checkdomain $chanban]} { return }
foreach chan $chanban {
putquick "samode $chanban +$chanmode"
} else {
utimer 60 [list $timemode]
putquick "samode $chanban -$chanmode"
}
}
} |
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Thu Sep 09, 2021 3:54 am Post subject: |
|
|
What is exactly the +E mode ?
And who did this script for you ? It does (when errors are corrected) exactly the invert of what you want.
Let me explain your script:
| Code: | set chanban "#test1 #test2"
set checkdomain {"*.mibbit.com"}
set chanmode "E"
set timemode "60"
bind join - * banmibbit
proc banmibbit {nick host hand chan} {
global chanban checkdomain chanmode timemode
if {![chan gets $chanban] || [isbotnick $nick]} { return 0 }
# [chan gets $chanban] is an error, so you alway exit from the proc
foreach checkdomain $chanban {
if {[string match $checkdomain $chanban]} { return }
# if domain is mibbit.com, you exit from the proc ???
foreach chan $chanban {
# reuse of $chan is a bad idea. And $chanban is not a list
putquick "samode $chanban +$chanmode"
# you send the command "samode #test1 #test2 +E" ???
} else {
# foreach ... else ... ? WTF ?
utimer 60 [list $timemode]
# what is doing your utimer ?
putquick "samode $chanban -$chanmode"
# you send the command "samode #test1 #test2 -E" ???
}
}
} |
And what happen if another mibbit user join the chan during the delay? the mode +E is sent, but the first timer (when corrected) will remove it _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Thu Sep 09, 2021 4:07 am Post subject: hi |
|
|
| mode +E is my module who block users with this hostmask of mibbit to talk in channe' |
|
| Back to top |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Thu Sep 09, 2021 4:17 am Post subject: hi |
|
|
and now how need to be ? now no errors but is not set mode on channels
| Code: |
set chanban "#test1 #test2"
set checkdomain {"*.mibbit.com"}
set chanmode "E"
set timemode "60"
bind join - * banmibbit
proc banmibbit {nick host hand chan} {
global chanban checkdomain chanmode timemode
if {![isbotnick $nick]} { return 0 }
foreach checkdomain $chanban {
if {[string match $checkdomain $chanban]} {
putquick "samode $chanban +$chanmode"
utimer 60 [list $timemode]
putquick "samode $chanban -$chanmode"
}
}
}
|
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Thu Sep 09, 2021 9:55 am Post subject: |
|
|
It's worst than the previous...
Here is a small version, with explanations inline
| Code: | set chanban "#test1 #test2"
set checkdomain {"*.mibbit.com"}
set chanmode "E"
set timemode "60"
bind join - * banmibbit
proc banmibbit {nick uhost hand chan} {
if {![string first [string tolower $chan] $::chanban] || [isbotnick $nick]} { return 0 }
# exit if the joined channel is not in $chanban or if the bot is joining
foreach dom $::checkdomain {
# loop on each domain to check
if {![string match -nocase $dom $uhost]} { continue }
# if user host doesn't match the domain, we continue (don't do the following)
foreach vchan [split $::chanban] {
# loop on each chan in $chanban
putquick "SAMODE $vchan +$::chanmode"
# do the SAMODE (just +E ?)
utimer $::timemode [list [putquick "SAMODE $vchan -$::chanmode"]]
# after the timer, the remove of the +E
}
}
} |
Note that this doesn't correct the trouble I specified: what happen if a mibbit user joins after 59 minutes ? The +E will be removed 1 min later, and 1h later, a try to do a -E will be done too.
Another point: why SAMODE ? only Services Admin can set the +E on a chan ? _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Thu Sep 09, 2021 1:48 pm Post subject: Hi |
|
|
If the user join 1 min after bot unset mode -E to set again evry time when or to stay +E is match hostmask *.mibbit.com till is not enter again
yes samode is for ircops opers flags command
Last edited by Gulio on Thu Sep 09, 2021 1:57 pm; edited 2 times in total |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Thu Sep 09, 2021 1:49 pm Post subject: |
|
|
CrazyCat: I think I might change this line of code... | Code: | | if {![string first [string tolower $chan] $::chanban] || [isbotnick $nick]} { return 0 } |
to something more like... | Code: | | if {([string first [string tolower $chan] $::chanban] == -1) || [isbotnick $nick]} { return 0 } |
[string first ..] returns -1 for "not found", not 0 _________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Thu Sep 09, 2021 2:03 pm Post subject: hi |
|
|
Spike^^ yes u right ur fix now works thx, but is set and unset mode now on join
| Code: |
[20:59:50] * Joins: pheleas_frog (59d2ec67@Test-AED0FB6F.mibbit.com)
[20:59:51] * irc.Test.com sets mode: +E
[20:59:51] * irc.Test.com sets mode: -E |
|
|
| Back to top |
|
 |
CrazyCat Revered One

Joined: 13 Jan 2002 Posts: 1032 Location: France
|
Posted: Thu Sep 09, 2021 7:00 pm Post subject: |
|
|
| SpiKe^^ wrote: | CrazyCat: I think I might change this line of code...
[string first ..] returns -1 for "not found", not 0 |
Yes, quick code, untested, it was more to show how it can be done and to explain how it works.
Thx SpiKe^^
| Gulio wrote: | If the user join 1 min after bot unset mode -E to set again evry time when or to stay +E is match hostmask *.mibbit.com till is not enter again
yes samode is for ircops opers flags command |
You don't answer my questions:
- what happen if the user join 1 minute before the unset ? actually, the initial unset will act. Let me show you:
<14:40:00> user1@abc.mibbit.com joined #dummy
<14:40:01> bot sets mode +E on #dummy
<15:39:00> user2@abc.mibbit.com joined #dummy
<15:39:01> (nothing, #dummy is already +E)
<15:40:01> bot sets mode -E on #dummy
<16:39:01> (nothing, #dummy is already -E)
And I know SAMODE is for services admin (not "ircops", some ircops), my question was to know if this mode can be set by a "simple" operator of the chan.
But as each time I try to help you, I say "never again", now I promise I stop. _________________ https://www.eggdrop.fr - French IRC network
Offer me a coffee - Do not ask me help in PM, we are a community. |
|
| Back to top |
|
 |
Gulio Halfop
Joined: 01 Nov 2020 Posts: 73
|
Posted: Thu Sep 09, 2021 8:41 pm Post subject: hi |
|
|
CracyCat
Need to kill time when a user join before expire time of unset mode so can start from start to count time maybe
but is ok thx a lot from ur help |
|
| Back to top |
|
 |
SpiKe^^ Owner

Joined: 12 May 2006 Posts: 792 Location: Tennessee, USA
|
Posted: Fri Sep 10, 2021 5:30 pm Post subject: Re: hi |
|
|
| Gulio wrote: | | ..., but is set and unset mode now on join |
Gulio: Try replacing this line of code... | Code: | | utimer $::timemode [list [putquick "SAMODE $vchan -$::chanmode"]] |
with something more like... | Code: | | utimer $::timemode [list putquick "SAMODE $vchan -$::chanmode"] |
_________________ SpiKe^^
Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
. |
|
| Back to top |
|
 |
|