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.

prohibit some commands to users

Help for those learning Tcl or writing their own scripts.
Post Reply
M
MasterEgg
Voice
Posts: 3
Joined: Mon Apr 04, 2011 6:29 pm

prohibit some commands to users

Post by MasterEgg »

Hello is in the title, I want to prohibit some commands all users except me of course, such as binds, modules, simul, die, loadmod unloadmod thank you for your help
w
willyw
Revered One
Posts: 1202
Joined: Thu Jan 15, 2009 12:55 am

Re: prohibit some commands to users

Post by willyw »

MasterEgg wrote:Hello is in the title, I want to prohibit some commands all users except me of course, such as binds, modules, simul, die, loadmod unloadmod thank you for your help
Log into your bot.
Issue these commands, and examine each result:
.binds *binds* all
.binds *modules* all
.binds *simul* all
.binds *die* all
.binds *loadmod* all
.binds *unloadmod* all

With a quick check on one of my bots, I find that all the above, execpt the
.binds
command, are already limited to only those users with +n.

If you wish to change the flags, at the end of your eggdrop.conf you could do something like this:

Code: Select all

unbind dcc  m|- binds *dcc:binds
bind dcc n|- binds *dcc:binds
I suppose that if you truly wanted to limit a command's use to ONLY you, and no other owner that has +n, then you could change the flag to a custom flag, and then give yourself that flag.


I hope this helps.
User avatar
caesar
Mint Rubber
Posts: 3777
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

You got 3 options:

1. don't give partyline access to people you don't trust;
2. use 'bind filt' to filter out the commands you wish;
3. rebind the commands you wish to prohibit to another flag of your choice;

Here's an example on using the filt to permit the command only if it's set as owner in the configuration file.

Code: Select all

bind filt - ".binds *" dcc:allow

proc dcc:allow {idx args} {
  set handle [idx2hand $idx]
  if {[lsearch -nocase $::owner $handle] == -1} {
    putdcc $idx "Permission denied."
    } else {
    return $args
  }
}
Haven't tested this but as far as I see this may have a major flaw (I haven't tested anything) as I seem to trigger '.binds' just by issuing '.bin' from party line.

@willyw : Apart the '.binds' ALL are already bound for global owner only:
TYPE FLAGS COMMAND HITS BINDING (TCL)
dcc n|- unloadmod 0 *dcc:unloadmod
dcc n|- loadmod 0 *dcc:loadmod
dcc m|- binds 9 *dcc:binds
dcc n|- modules 0 *dcc:modules
dcc n|- simul 0 *dcc:simul
dcc n|- die 0 *dcc:die
Once the game is over, the king and the pawn go back in the same box.
M
MasterEgg
Voice
Posts: 3
Joined: Mon Apr 04, 2011 6:29 pm

Post by MasterEgg »

Thanks :)
Post Reply