This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Simple public command.

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Simple public command.

Post by samhain »

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.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Code: Select all

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. :roll:
Last edited by caesar on Mon Feb 21, 2011 1:54 am, edited 6 times in total.
Once the game is over, the king and the pawn go back in the same box.
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Post by samhain »

(@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.
((USARMY): [19:50] Tcl error [myx:ban]: wrong # args: should be "maskhost nick!user@host"
gives this error. Could you please analyze thanks. :)

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).
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Indeed, I rushed and forgot to create the '.k' bind. :) 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.
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Post by samhain »

((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
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

</face palm>beginner mistakes. :roll:

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.
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Post by samhain »

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....
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

You might wanna try updating to the new version of eggdrop
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

What error? Be more specific please.
Once the game is over, the king and the pawn go back in the same box.
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Post by samhain »

((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.
User avatar
caesar
Mint Rubber
Posts: 3776
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

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.
s
samhain
Halfop
Posts: 77
Joined: Wed Jan 03, 2007 5:19 am

Post by samhain »

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.
Post Reply