egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

ChanServ Akick

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
illusionist
Voice


Joined: 09 Mar 2020
Posts: 25

PostPosted: Wed Jul 15, 2020 10:32 pm    Post subject: ChanServ Akick Reply with quote

Hello Everyone This is a small ChanServ TCL and it is working very well. It does not have a check system to show the error message that Nick is already added in akick list of channel or nick is not found in akick list of channel when adding or removing akick.

If aome one can add a check system .. really appreciated
Thanks in advance
Code:
set chanserv "chanserv@services.dal.net"

setudef flag chanserv


###Chanserv Add Akick
proc accessakick {nick host handle channel testes} {
    global nxg chanserv
if {[channel get $channel chanserv]} {
    set who [lindex $testes 0]
    set reason [lrange $testes 1 end]
    if {$reason == ""} {set reason "\0032In \00312compliance \0032with the aDministration of \00312$channel\017 \002\037\0037(\017\00312\u00bb\0031\002j\002a\0034\002D\002u\0031\u00ae\00312\u00ab\0037\002\037)\017"
    }
   putserv "PRIVMSG $chanserv :akick $channel add $who $reason"
   putserv "NOTICE $nick :$who added to $channel Akick list."
    putlog "$nick added $who to the Akick list in $channel"
 }
}
###End Of Chanserv Add Akick

###Chanserv Remove Akick
proc accessremoveakick {nick host handle channel testes} {
    global nxg chanserv
if {[channel get $channel chanserv]} {
   set who [lindex $testes 0]
   putserv "PRIVMSG $chanserv :akick $channel del $who"
   putserv "NOTICE $nick :$who deleted from $channel Akick list."
    putlog "$nick removed $who from the Akick list in $channel"
 }
}
###End Of Chanserv Remove Akick
Back to top
View user's profile Send private message
CrazyCat
Revered One


Joined: 13 Jan 2002
Posts: 1032
Location: France

PostPosted: Thu Jul 16, 2020 12:51 am    Post subject: Reply with quote

Quite hard to do: services use msg or notice (depend on your choice and the default choice of admin) and can use the language you want.
So you'll have to bind pubs and notices, and have the correct sentences interesting you.

Simpliest to do a /msg chanserv akick...
_________________
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
View user's profile Send private message Visit poster's website
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Thu Jul 16, 2020 7:03 am    Post subject: Reply with quote

u could try this:

Code:

bind pub -!- .akick pub-add-akick

proc pub-add-akick {nick host hand chan text} {
       if {![matchattr [nick2hand $nick] o|o $chan] && ![isop $nick $chan] && ![ishalfop $nick $chan]} { return 0  }
   global anick
    set anick $nick
  set who [lindex [split $text] 0]
  set reason [join [lrange [split $text] 1 end]]
  if {$reason == ""} {set reason "\0032In \00312compliance \0032with the aDministration of \00312$chan\017 \002\037\0037(\017\00312\u00bb\0031\002j\002a\0034\002D\002u\0031\u00ae\00312\u00ab\0037\002\037)\017"
  set items [split $text]
  if {[llength $items] < 1} {
    putserv "NOTICE $nick :Syntax\: .akick \[mask\] \[reason\]"
    return
  }
   putserv "chanserv akick $chan add $who $reason"
   putserv "NOTICE $nick :$who added to $chan Akick list."
 }
}


bind notc - "*already exists on the AKICK list of*" duplicate-akick

proc duplicate-akick {nick uhost hand text dest} {
global anick
if {[string match -nocase $nick chanserv]} { putserv "notice $anick :\002$text\002"}
 }


Back to top
View user's profile Send private message
caesar
Mint Rubber


Joined: 14 Oct 2001
Posts: 3741
Location: Mint Factory

PostPosted: Thu Jul 16, 2020 8:44 am    Post subject: Reply with quote

I saw this in another topic and wanted to ask you about it in there but forgot. Anyway, why do you use nick2hand if you already have the handle (the name of the user's account on the bot) set in hand variable when the pub-add-akick process is triggered?

Right now that first if line will 'return 0' if the user isn't local "operator" or global "operator" AND isn't channel operator (having a @, not necessarily access on the bot) AND isn't a halfop. You sure this is the wanted behavior?

Anyway, I don't see the point of the matchattr part entirely when you can just change at the flags on the bind directly, I mean changing from:
Code:

bind pub -!- .akick pub-add-akick

to:
Code:

bind pub o|o .akick pub-add-akick

that will basically have the same effect.

I'll show you a nifty trick with lassign, turning this:
Code:

  set who [lindex [split $text] 0]
  set reason [join [lrange [split $text] 1 end]]

into this:
Code:

set reason [lassign $text who]

results:
Code:

% set text "user some long reason in here"
% set reason [lassign $text who]
some long reason in here
% puts $who
user
% puts $reason
some long reason in here

It would be a good idea if you would move the:
Code:

if {[llength $items] < 1} {

higher, preferable after the 1st line and make it into:
Code:

if {![llength $text]} {

that translates if the text variable content's length is 0 (or empty) then do whatever you want.
_________________
Once the game is over, the king and the pawn go back in the same box.
Back to top
View user's profile Send private message
simo
Owner


Joined: 22 Mar 2015
Posts: 941

PostPosted: Thu Jul 16, 2020 9:43 am    Post subject: Reply with quote

nice tnx caesar
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber