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 

Simple public command.

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
samhain
Halfop


Joined: 03 Jan 2007
Posts: 77

PostPosted: Fri Feb 18, 2011 3:12 pm    Post subject: Simple public command. Reply with quote

Hi, I'm looking for a simple public commands script.

The command must start with the character ! or .

The commands should be the following with the following features.

.o (To op yourself)
.deop (to deop)

.b nick reason (To ban the *!*@host.domain of a user with the certain reason, the ban must be performed by (Undernet)'s service X)

.k nick reason (Simple kick with the specified reason)

.nb nick (To ban the nick!*@* of a user with reason Bad nick, change it and rejoin the ban must be performed by X (Undernet)'s service).

The flags for the people who'd be using these commands should be o (global).
that's all.
Thanks.
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Sat Feb 19, 2011 5:45 am    Post subject: Reply with quote

Code:

bind pub o| .o myx:op
bind pub o| .deop myx:deop
bind pub o| .b myx:ban
bind pub o| .nb myx:nickban
bind pub o| .k myx:kick

proc myx:op {nick uhost hand chan text} {
  if {[botisop $chan]} {
    pushmode $chan +o $nick
  }
}

proc myx:deop {nick uhost hand chan text} {
  if {[botisop $chan]} {
    pushmode $chan -o $nick
  }
}

proc myx:ban {nick uhost hand chan text} {
  if {[llength $text] >= 2} {
    set user [lindex [split $text] 0]
    if {![onchan $user $chan]} {
      putserv "NOTICE $nick :sorry, $user is not on channel"
      } else {
      set reason [lrange [split $text] 1 end]
      set mask "*!*@[lindex [split [getchanhost $user $chan] "@"] 1]"
      putserv "PRIVMSG X :ban $chan $mask $reason"
    }
    } else {
    putserv "NOTICE $nick :.b <nick> <reason>"
  }
}

proc myx:kick {nick uhost hand chan text} {
  if {[llength $text] >= 2} {
    set user [lindex [split $text] 0]
    if {![onchan $user $chan]} {
      putserv "NOTICE $nick :sorry, $user is not on channel"
      } else {
      set reason [lrange [split $text] 1 end]
      putserv "PRIVMSG X :kick $chan $user $reason"
    }
    } else {
    putserv "NOTICE $nick :.k <nick> <reason>"
  }
}

proc myx:nickban {nick uhost hand chan text} {
  if {[llength $text]} {
    set user [lindex [split $text] 0]
    if {![onchan $user $chan]} {
      putserv "NOTICE $nick :sorry, $user is not on channel"
      } else {
      putserv "PRIVMSG X :ban $chan $user!*@* Bad nick, change it and rejoin"
    }
    } else {
    putserv "NOTICE $nick :.nb <nick>"
  }
}

I'm not 100% sure about the commands that are sent to X, so you should change them them accordingly.

Edit: fixed again. Rolling Eyes
_________________
Once the game is over, the king and the pawn go back in the same box.


Last edited by caesar on Mon Feb 21, 2011 1:54 am; edited 6 times in total
Back to top
View user's profile Send private message
samhain
Halfop


Joined: 03 Jan 2007
Posts: 77

PostPosted: Sat Feb 19, 2011 3:52 pm    Post subject: Reply with quote

Quote:

(@Hawk-): .k musk bye
(@Hawk-): .nb musk
-USARMY- .nb <nick> <reason>
(@Hawk-): .nb musk bad
*** X sets mode: +b musk!*@*
*** [#islamabad] Banned- musk
*** musk was kicked by X ((LilleHopp) Feb 19:Bad nick, change it and rejoin)

The kick command is not working perhaps the bind for .k is missing that's why, Also I'd like to say that .nb nick (doesn't require a reason) if an op uses .nb nick syntax the nick should be automatically banned with the default reason Bad nick, change it and rejoin.

The
.b command is also not working.
Quote:

((USARMY): [19:50] Tcl error [myx:ban]: wrong # args: should be "maskhost nick!user@host"

gives this error. Could you please analyze thanks. Smile

Also I'd like to have it, that the .o (the bot doesn't use X to op a certain person, but ops it itself).
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Sat Feb 19, 2011 6:46 pm    Post subject: Reply with quote

Indeed, I rushed and forgot to create the '.k' bind. Smile I've edited my previous post and updated the code.
_________________
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
samhain
Halfop


Joined: 03 Jan 2007
Posts: 77

PostPosted: Sun Feb 20, 2011 6:00 am    Post subject: Reply with quote

Quote:

((USARMY): [09:58] Tcl error [myx:ban]: wrong # args: should be "maskhost nick!user@host"

pushmode"$chan -o $nick

also gives that .o error somewhere in that syntax

Gives this error, for .b command, otherwise it's working fine.

And could you also tell me what should I write with $reason so that the bot also displays the handle of the op who uses the .k and .b commands. in the kick/ban messages
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Mon Feb 21, 2011 1:51 am    Post subject: Reply with quote

</face palm>beginner mistakes. Rolling Eyes

Btw, what version of eggdrop are you using?

It's weird as from what I read in tcl-commands.doc the 'getchanhost' returns user@host thus the need to add "nick!" and "maskhost" that expects a "nick!user@host" and a masktype (integer), that if is not specified will be by default 2.

As for adding the user handle in the reason, use '$hand' before $reason or after it, like "$hand $reason" or "$reason $hand".
_________________
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
samhain
Halfop


Joined: 03 Jan 2007
Posts: 77

PostPosted: Mon Feb 21, 2011 5:43 am    Post subject: Reply with quote

I'm using eggdropv1.6.17.tar.gz....

Do I need to edit some thing in your specified code...... cause it still gives that error....
Back to top
View user's profile Send private message
blake
Master


Joined: 23 Feb 2009
Posts: 201

PostPosted: Mon Feb 21, 2011 6:27 am    Post subject: Reply with quote

You might wanna try updating to the new version of eggdrop
_________________
Blake
UKEasyHosting UKStormWatch
Back to top
View user's profile Send private message Visit poster's website
caesar
Mint Rubber


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

PostPosted: Mon Feb 21, 2011 9:01 am    Post subject: Reply with quote

What error? Be more specific please.
_________________
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
samhain
Halfop


Joined: 03 Jan 2007
Posts: 77

PostPosted: Mon Feb 21, 2011 11:32 am    Post subject: Reply with quote

Quote:

((USARMY): [09:58] Tcl error [myx:ban]: wrong # args: should be "maskhost nick!user@host"


This error, I'd try testing this TCL with 1.6.20, will see if it works there.
Back to top
View user's profile Send private message
caesar
Mint Rubber


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

PostPosted: Mon Feb 21, 2011 11:51 am    Post subject: Reply with quote

I've changed the previous code quite a few hours ago. Re-copy/paste it in to your .tcl file and rehash.
_________________
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
samhain
Halfop


Joined: 03 Jan 2007
Posts: 77

PostPosted: Mon Feb 21, 2011 11:43 pm    Post subject: Reply with quote

Great work there, caesar, Really appreciate your help, I'd suggest you to add a few commands, and upload it as a TCL on egghelp. It's really needed by many users on IRC.
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 -> Script Requests 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