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.

Request for script

Old posts that have not been replied to for several years.
Locked
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Request for script

Post by metroid »

Can someone make a script where on /msg $botname op/voice/ban/unban <host> it will do it without giving a password, just having to be in the bot with an +o flag or higher.

For example,

/msg <botnick> op #testchannel

* <botnick> sets mode: +o MeTroiD (in #testchannel)

/msg <botnick> voice #testchannel

* <botnick> sets mode: +v MeTroiD (in #testchannel)

/msg <botnick> ban #testchannel <userhost>

* <botnick> sets mode: +b <userhost> <- This has to be perm untill unbanned with,

/msg <botnick> unban #testchannel <userhost>

* <botnick> sets mode: -b <userhost> (if the ban is still active, but the has to be removed from the memory so the bot doesnt keep enforcing it)

If someone can make me this script i would be very gratefull :)
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

Code: Select all

bind msg - * msg:commands
proc msg:commands { nick host handle arg } {
  set command [lindex $arg 0]
  set channel [lindex $arg 1]
  set host [lindex $arg 2]
  
  if {($channel == "") || ![validchan $channel] || ![botisop $channel]} then {
    return 0
  }
  if {$command == "op"} then {
    putserv "MODE $channel +o $nick"
  } elseif {$command == "voice"} then {
    putserv "MODE $channel +v $nick"
  } elseif {$command == "ban"} then {
    if {$host != ""} then {
      newchanban $channel $host $nick "No comment" *
    }
  } elseif {$command  == "unban"} then {
    if {($host != "") && [isban $host $channel]} then {
      killchanban $channel $host
    }
  }
  return 0
} ;# msg:commands
Should be enough for you.
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Hmm, I loaded the script, but when i try to use it, i get this for op

[18:47:39] <|A|> [18:47] (MeTroiD!~vulkcoc@MeTroiDz.users.quakenet.org) !*! failed OP

This for Voice

[18:48:25] <|A|> [18:48] (MeTroiD!~vulkcoc@MeTroiDz.users.quakenet.org) !*! failed VOICE

If i attempt the ban it just shows me this in the DCC chat

[18:51:02] <|A|> [18:51] [MeTroiD!~vulkcoc@MeTroiDz.users.quakenet.org] ban #TheABot fish@go.moo.oh.yes.they.do fishbot

I havent tried the unban yet
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

You need to disable original binds for op and voice. Use this fixed code:

Code: Select all

unbind msg -|- op *msg:op
unbind msg -|- voice *msg:voice
bind msg - * msg:commands
proc msg:commands { nick host handle arg } { 
  set command [lindex $arg 0] 
  set channel [lindex $arg 1] 
  set host [lindex $arg 2] 
  
  if {($channel == "") || ![validchan $channel] || ![botisop $channel]} then { 
    return 0 
  } 
  if {$command == "op"} then { 
    putserv "MODE $channel +o $nick" 
  } elseif {$command == "voice"} then { 
    putserv "MODE $channel +v $nick" 
  } elseif {$command == "ban"} then { 
    if {$host != ""} then { 
      newchanban $channel $host $nick "No comment" * 
      putserv "MODE $channel +b $host"
    } 
  } elseif {$command  == "unban"} then { 
    if {($host != "") && [isban $host $channel]} then { 
      killchanban $channel $host 
    } 
  } 
  return 0 
} ;# msg:commands 
User avatar
caesar
Mint Rubber
Posts: 3778
Joined: Sun Oct 14, 2001 8:00 pm
Location: Mint Factory

Post by caesar »

Tip: instead of a lot of if's use the switch TCL command. And "foo" is not equal with "FOO" or "fOO", "foO" and so on, use an "string tolower" inside your checks if you still want to use a lot of if's and else's..

Example of switch:

Code: Select all

switch -- $command { 
  "foo" { 
    # do foo 
  } 
  "moo" { 
    # do moo 
  } 
  default { 
    # default thing to do when is not "foo" or "moo" 
  } 
} 
Also, note that arg has a special meaning. Do a Search for more informations about this. I'm way to lazy to do it for you. Don't forget to split a string before using it as a list. Drop the "then" thing, this is not C.. :D
Once the game is over, the king and the pawn go back in the same box.
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

I don't like swich too much and thats why i used ifs. Both methods will gime same result. Good poing with those tolower, i just forgot about it ;)
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

Here we go again... a similar discussion brewing as the one we tried to straighten awyeah out on... (think we failed getting through to him though, not sure...)

In any event, the msg bind doesn't accept wildcards... you need to use the msgm bind.. See tcl-commands.doc that comes with your eggdrop.
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

You're right, my mistake.

MeTroiD replace:

Code: Select all

bind msg - * msg:commands
by

Code: Select all

bind msgm - * msg:commands
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

I think the switch is a better easier, and non messy way of dealing with this type of structure.. I agree with caesar.
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
User avatar
KrzychuG
Master
Posts: 306
Joined: Sat Aug 16, 2003 2:51 pm
Location: Torun, Poland
Contact:

Post by KrzychuG »

Nobody said it isn't. I just said that i don't like it too much. Anyway it seems to be offtopic.
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Thanks :)

The op and voice works fine, I don't know but the ban command doesnt work but its not that important anyway,

Thanks again! :D
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Could someone make me a script like L or Q has * For instance, If you do /msg Q showcommands on Quakenet the bot replies with a long list of its commands that you as auth level have access too. *

If your an op (or higher) in the bot and you do this for example "/msg |A| showcommands" it will notice you the commands your allowed to do.

"-|A|- op #channel | This will make the bot op you in that channel"
"-|A|- voice #channel | This will make the bot voice you in that channel"
ect ect.

But if the normal user is doing "/msg |A| showcommands" and isnt in the bots userlist it should reply with:

"-|A|- You have no commands available"

All the responses have to be in notice :D

I dont know if its too hard to make but i know you probally have to do something with "if {matchchattr o} putserv "notice $nick :blah blah"

I would be gratefull if you could make something like this :)
User avatar
awyeah
Revered One
Posts: 1580
Joined: Mon Apr 26, 2004 2:37 am
Location: Switzerland
Contact:

Post by awyeah »

There are many channel management scripts out there.
They add flags for each user for seperate access such
as basic, master, owner, administartor etc levels.

With different types of access you are allowed to use
commands within the access you have. I guess you could
get the list of the commands for your access as well.

I don't remember the names, but I had downloaded quite
alot of scripts similiar to these and still have them on my
hard disk.

Try searching the egghelp tcl archive.
http://www.egghelp.org/tcl.htm
·­awyeah·

==================================
Facebook: jawad@idsia.ch (Jay Dee)
PS: Guys, I don't accept script helps or requests personally anymore.
==================================
m
metroid
Owner
Posts: 771
Joined: Wed Jun 16, 2004 2:46 am

Post by metroid »

Thanks, But i decided to write my own, it took some time (as im a beginner) but im getting there ^_^

Code: Select all

bind msg - showcommands msg:sc
bind msg o public msg:sc3
bind msg - help msg:sc2

proc msg:sc {nick uhost hand rest} {
	putserv "NOTICE $nick :All commands here are used with /msg $::botnick <command>"
	putserv "NOTICE $nick :The Following Commands are available:"
	putserv "NOTICE $nick :showcommands - Lists all the commands on the bot."
	putserv "NOTICE $nick :public       - Lists all the public commands of the bot."
	putserv "NOTICE $nick :help         - Gives full help on a particular bot command."
	putserv "NOTICE $nick :voice        - Gives you +v on a channel where the bot is."
	putserv "NOTICE $nick :op           - Gives you ops on a channel where the bot is."
	putserv "NOTICE $nick :invite       - Invites you to a channel where the bot is."
	putserv "NOTICE $nick :welcome      - Show/set welcome message on a channel."
	putserv "NOTICE $nick :chanlev      - Change/view someone's rights on a channel."
	putserv "NOTICE $nick :Note: You need to be in the chanlev to use these commands."
}

proc msg:sc3 {nick uhost hand rest} {
	putserv "NOTICE $nick :All commands here are used in a channel with the bot"
	putserv "NOTICE $nick :The Following Commands are available:"
	putserv "NOTICE $nick : spamscan on/off       - Ban after 2 violations of the rules."
	putserv "NOTICE $nick : settopic              - Makes the bot send the data to Q whom will set the Topic then."
	putserv "NOTICE $nick : glist                 - Gives you info on any Glined channel/users/hosts."
	putserv "NOTICE $nick : peak                  - Tells you the highest user count the bot has seen."
	putserv "NOTICE $nick : antiad on/off             - An instant banning on advertise of a channel function."
	putserv "NOTICE $nick : antitake on/off       - An anti takeover function which protects a channel from takeovers."
	putserv "NOTICE $nick : check <nick>          - Displays a person's flags in Q."
	putserv "NOTICE $nick : auth <nick>           - Will display the auth of a person."
	putserv "NOTICE $nick : autolimit #num on/off - Sets an autolimit in the channel."
	putserv "NOTICE $nick :Note: You need to be in the bot's userlist to use these commands."
}

proc msg:sc2 {nick uhost hand text} {
	if {$text == "showcommands"} {
	putserv "NOTICE $nick :/msg $::botnick SHOWCOMMANDS"
	putserv "NOTICE $nick :Lists the commands available on the bot. This won't list commands above your level."
	} elseif {$text == "voice"} {
	putserv "NOTICE $nick :/msg $::botnick VOICE <channel>"
	putserv "NOTICE $nick :Gives you +v (voice) on a channel which the bot is sitting on. The bot *must* be on the channel, and you must have a high enough level on that channel. (+v or higher)"
	} elseif {$text == "op"} {
	putserv "NOTICE $nick :/msg $::botnick OP <channel>"
	putserv "NOTICE $nick :Gives you ops on a channel which the bot is sitting on. The bot *must* be on the channel, and you must have a high enough level on that channel. (+o or higher)"
	} elseif {$text == "invite"} {
	putserv "NOTICE $nick :/msg $::botnick INVITE <channel>"
	putserv "NOTICE $nick :Invites you to a channel which the bot is sitting on. The bot *must* be on the channel, and you must have a high enough level on that channel."
	} elseif {$text == "welcome"} {
	putserv "NOTICE $nick :/msg $::botnick WELCOME <channel>			Show welcome message"
	putserv "NOTICE $nick :/msg $::botnick WELCOME <channel> <message>	Set welcome message"
	} elseif {$text == "chanlev"} {
	putserv "NOTICE $nick :/msg $::botnick CHANLEV <channel> <authname> <change flags>"
	putserv "NOTICE $nick :Change someone's flags/rights on a channel. The Authname has to be EXACT or it will not work."
	putserv "NOTICE $nick :e.g: /msg $::botnick CHANLEV #sheep.go.meh MeTroiDz +amno - Where the bot has now added the flags +amno to the auth MeTroiDz on the channel #sheep.go.meh"
	putserv "NOTICE $nick :/msg $::botnick CHANLEV #chan                  Dump all users on the channel."
	putserv "NOTICE $nick :/msg $::botnick CHANLEV #chan authname         View a user's flags on that channel"
	putserv "NOTICE $nick :/msg $::botnick CHANLEV #chan authname +-flag  Change a user's flags on the channel."
	putserv "NOTICE $nick :The following flags are useable:-"
	putserv "NOTICE $nick : +a = autoop/autovoice on join."
	putserv "NOTICE $nick : +b = banned. (Only works if they've AUTH'd.)"
	putserv "NOTICE $nick : +m = master. (Can make opers.)"
	putserv "NOTICE $nick : +n = owner. (Can make masters and opers.)"
	putserv "NOTICE $nick : +o = op."
	putserv "NOTICE $nick : +v = voice."
	} elseif {$text == "public"} {
	putserv "NOTICE $nick :/msg $::botnick public"
	putserv "NOTICE $nick :Will show you all the public commands available on $::botnick (Nothing here yet)"
	} elseif {$text == "spamscan"} {
	putserv "NOTICE $nick :Useage: SPAMSCAN on/off e.g: spamscan on"
	putserv "NOTICE $nick :SpamScan will detect any advertisements. It will kickban if advertised more than twice."
	} elseif {$text == "settopic"} {
	putserv "NOTICE $nick :Useage: SETTOPIC <New Topic> e.g: settopic moo"
	putserv "NOTICE $nick :If there is a Q present in the channel and the bot has the right flags it will set the topic using Q."
	} elseif {$text == "glist"} {
	putserv "NOTICE $nick :Useage: GLIST <channel | <nick!ident@host> e.g: glist #sheep.go.meh"
	putserv "NOTICE $nick :This will check if there is a gline on the specified channel/nick."
	} elseif {$text == "peak"} {
	putserv "NOTICE $nick :Useage: PEAK"
	putserv "NOTICE $nick :This will msg the channel with the highest usercount on the channel."
	} elseif {$text == "antiad"} {
	putserv "NOTICE $nick :Useage: ANTIAD on/off e.g: antiad on"
	putserv "NOTICE $nick :This will trigger a script which kickbans when a user advertises in the channel."
	} elseif {$text == "check"} {
	putserv "NOTICE $nick :Useage: CHECK <nick> e.g: check MeTroiD"
	putserv "NOTICE $nick :This script will query Q and request the Q flags for <nick> and then display them in the channel."
	} elseif {$text == "auth"} {
	putserv "NOTICE $nick :Useage: AUTH <nick> e.g: auth MeTroiD"
	putserv "NOTICE $nick :This script will tell the person what the auth of a person is. e.g: <$::botnick> MeTroiD is authed as MeTroiDz."
	} elseif {$text == "autolimit"} {
	putserv "NOTICE $nick :Useage: AUTOLIMIT #number on/off"
	putserv "NOTICE $nick :This will set an autolimit in the channel you use the command in."
	} else {
	putserv "NOTICE $nick :Try /msg $::botnick SHOWCOMMANDS  or /msg $::botnick HELP <command>"
	}
}

putlog "Showcommands by MeTroiD"
This is the script how i use it with the scripts i use with it so anyone that wants to use it, you will have to modify it to your own bots scripts. Its not completly finished as i have some more commands to add, but you can use it :mrgreen:
Locked