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.

add owner in eggdrop

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
User avatar
aslpls
Halfop
Posts: 66
Joined: Mon May 02, 2016 9:41 am

add owner in eggdrop

Post by aslpls »

hi, good day to all. i would like to request a simple tcl for adding as a owner in eggdrop.

let's say i have an eggdrop bot and i need to add my friend as owner in eggdrop.


Cmds be like:

botname: !add owner myfriend
botname: Added user myfriend with hostmask: *!*myfriend@myfriend.users.undernet.org


thank you for anyone who can help.
It was FUNNY!
User avatar
CrazyCat
Revered One
Posts: 1326
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Re: add owner in eggdrop

Post by CrazyCat »

That's a quite dangerous script.
proc addowner {nick uhost handle chan text} {
   if {![onchan $text $chan]} {
      putserv "PRIVMSG $nick :Sorry, can't find $text on $chan"
      return
   }
   set victhost [maskhost "$text![getchanhost $text $chan]" 1]
   adduser $text $victhost
   chattr $text +n $chan
}
bind pub n|- "!addowner" addowner
Note that you must be owner of the eggdrop to add someone, and he'll be owner on the channel, not global.

Not tested, adapt it as you need.
User avatar
aslpls
Halfop
Posts: 66
Joined: Mon May 02, 2016 9:41 am

Re: add owner in eggdrop

Post by aslpls »

hello Crazycat, i'll test it and update here soon...
It was FUNNY!
User avatar
aslpls
Halfop
Posts: 66
Joined: Mon May 02, 2016 9:41 am

Re: add owner in eggdrop

Post by aslpls »

@Crazycat, i find this .. it works .. does this code ok?

Code: Select all

proc addowner:pub {nick uhost hand chan arg} {
    # Check if the user has the necessary permission
    if {![matchattr [nick2hand $nick] n]} {
        return
    }

    # Extract the owner's nickname from the argument
    set owneradd [lindex [split $arg] 0]

    # Validate the nickname parameter
    if {$owneradd eq ""} {
        putquick "PRIVMSG $chan :\037ERROR\037: Incorrect Parameters. \037SYNTAX\037: [addTrigger]addowner nickname"
        return
    }

    # Check if the owner is a valid user
    if {[validuser [nick2hand $owneradd]]} {
        putquick "PRIVMSG $chan :\037ERROR\037: $owneradd is already a valid user."
        return
    }

    # Check if the owner is on the channel
    if {![onchan $owneradd $chan]} {
        putquick "PRIVMSG $chan :\037ERROR\037: $owneradd is not even on $chan ..."
        return
    }

    # Get the hostmask of the owner and add them as a global owner
    set chanhost [getchanhost $owneradd $chan]
    set mask *!*@[lindex [split $chanhost @] 1]

    adduser $owneradd $mask
    chattr $owneradd +n

    # Send notifications to the involved users
    putquick "NOTICE $nick :Added $owneradd to the Global Owner List."
    putquick "NOTICE $owneradd :$nick ($hand) has added you to the Global Owner List."
}

just need a comments from veteran coders :) .
It was FUNNY!
Post Reply