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.

gseen limited to chanops and users with certain flags

Help for those learning Tcl or writing their own scripts.
Post Reply
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

gseen limited to chanops and users with certain flags

Post by simo »

i was wondering how to edit gseen to give only certain users access to its commands like chanops and users with certain flags.


Should it be edited in the conf or elsewhere:



Code:

Code: Select all

######
#####
###   General Settings
#####
######

# the file where the seen data will be backuped.
# WARNING: set this _before_ the module is loaded.
set gseenfile "gseen.dat"

# now load the module
loadmodule gseen

# load the English language file
loadseenslang "en" "English" language/gseen.en.lang

# load the German language file
loadseenslang "de" "Deutsch" language/gseen.de.lang

# set the default language to english...
set default-slang "en"

# ... but let #xwp use the german langfile
setchanseenlang #xwp "de"

# the char that marks public commands (!seen, etc...)
# "" is a valid option
set cmdchar "!"

# delete data sets that are older than x days
set expire-seens 60

# only answer x seen requests in y seconds to prevent flooding
set max-seens 1:20

# tell users if someone was !seen'ing for them
set tell-seens 1

# check if the user was online under a different nick
set fuzzy-search 1

# allow user to include wildcards in the search?
set wildcard-search 1

# break search if there are more than x matches
set max-matches 250

# forward a request to other bots, if a !seen returned no result?
set botnet-seens 1

# store channels, which are +secret on the bot as [secret]?
set hide-secret-chans 1

# backup the seen data every x minutes
set save-seens 60

######
#####
###   AI Settings
#####
######

# this setting configures on which sentences your bot should
# attempt to do an ai-seen. Each of them is a simple wildcard
# mask. Set this to "" if you want to deactivate ai-seens or
# create more precise masks if the bots reacts too often.
set ai-seen-binds {
  "${nick}*seen*"
  "${botnet-nick}*seen*"
  "${nick}*gesehen*"
  "${botnet-nick}*gesehen*"
}

# this is just the same as above, but if triggered it will
# not do an ai-seen, but display its seen-stats.
set ai-seenstats-binds {
  "${nick}*seenstats*"
  "${botnet-nick}*seenstats*"
}

# when doing an AI seen, ignore the following words (otherwise
# the bot might give weird answers like "<bot> nick, bot was last seen..." :)
set ai-seen-ignore "$nick ${botnet-nick} seen"

######
#####
###   special stuff (can be ignored in most cases)
#####
######

# Maximum length of requested nick that will still be processed.
# (by default this is eggdrop's configured nick-length)
set seen-nick-len ${nick-len}

# if the user is known by the bot, log their handle instead of the nick
# (not recommended, might cause confusion by the users)
set use-handles 0

######
#####
###   outdated settings (only important for eggdropv1.4 users)
#####
######

# channels where you do not want your bot to reply to public queries
set no-pub-seens "#help"

# channels where you want your bot to send replies via notice to the user and
# not to the channel
set quiet-seens ""

# same as quiet-seens but for AI seen
set quiet-ai-seens ""

# channels where you do not want your bot to log seen data
set no-seendata "#help"
 

###############################################################################
# end of configuration
# just ignore everything below ^_^
###############################################################################

bind chjn - * *chjn:gseen
bind chpt - * *chpt:gseen

catch "unbind pub - !seen *pub:!seen"
catch "unbind pub - !seennick *pub:!seennick"
catch "unbind pub - !seenstats *pub:!seenstats"
bind pub - ${cmdchar}seen *pub:!seen
bind pub - ${cmdchar}seennick *pub:!seennick
bind pub - ${cmdchar}seenstats *pub:!seenstats

foreach bnd [binds pubm] {
  if {([lindex $bnd 2] == "*pubm:seen") || ([lindex $bnd 2] == "*pub:!seenstats")} {
    unbind [lindex $bnd 0] [lindex $bnd 1] [lindex $bnd 2] [lindex $bnd 4]
  }
}

if {${ai-seen-binds} != ""} {
  foreach mask ${ai-seen-binds} {
    bind pubm -|- "% [subst $mask]" *pubm:seen
  }
}

if {${ai-seenstats-binds} != ""} {
  foreach mask ${ai-seenstats-binds} {
    bind pubm -|- "% [subst $mask]" *pub:!seenstats
  }
}
i see the pub bind for the commands but cant find the process for it
User avatar
CrazyCat
Revered One
Posts: 1306
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

Peharps you miss the line:
loadmodule gseen
gseen is a module, the tcl file is just for some configuration.
w
willyw
Revered One
Posts: 1205
Joined: Thu Jan 15, 2009 12:55 am

Re: gseen limited to chanops and users with certain flags

Post by willyw »

simo wrote:i was wondering how to edit gseen to give only certain users access to its commands like chanops and users with certain flags.


Should it be edited in the conf or elsewhere:

...

Code: Select all


bind pub - ${cmdchar}seen *pub:!seen
bind pub - ${cmdchar}seennick *pub:!seennick
bind pub - ${cmdchar}seenstats *pub:!seenstats

...

i see the pub bind for the commands but cant find the process for it

I don't know what you mean by, "... the process for it" .
Please elaborate.

In the meantime :
Experiment with the bind lines that you found, and are quoted above.
If you are unfamiliar with the use of
bind pub
then visit: https://docs.eggheads.org/mainDocs/tcl-commands.html
and text search for: bind pub
and read.

Also see: http://suninet.the-demon.de/041.htm

And to get a list of flags, in partyline do: .help whois
or visit: http://www.egghelp.org/commands/core.htm#whois

Remember! - when editing bind lines, a simple .rehash is not good enough.
If you use .rehash to implement your edit, you might get unexpected (and confusing ) results.
The simple way to be sure, after editing a bind line, is to use .restart .
(There are other ways, but that is the simple way. )


I hope this helps.
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

CrazyCat wrote:Peharps you miss the line:
loadmodule gseen
gseen is a module, the tcl file is just for some configuration.
Thanks crazycat im aware it's a module and loaded fine i just wanted to have like chanops isop and users with flag o to have access to the public command and no one else if that's possible
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Re: gseen limited to chanops and users with certain flags

Post by simo »

Thanks willyw i already experimented with that but needed to find s way to check for like isop and ishalfop as well
User avatar
CrazyCat
Revered One
Posts: 1306
Joined: Sun Jan 13, 2002 8:00 pm
Location: France
Contact:

Post by CrazyCat »

simo wrote:
CrazyCat wrote:Peharps you miss the line:
loadmodule gseen
gseen is a module, the tcl file is just for some configuration.
Thanks crazycat im aware it's a module and loaded fine i just wanted to have like chanops isop and users with flag o to have access to the public command and no one else if that's possible
The only way you have, it's to modify binds to call your own procedure which will check user and then call the original procedure.
Example:

Code: Select all

# bind pub - ${cmdchar}seen *pub:!seen
bind pub - ${cmdchar}seen mypub:seen
proc mypub:seen {nick uhost handle chan text} {
   if {[isop $nick $chan] || [ishalfop $nick $chan]} {
      *pub:!seen $nick $uhost $handle $chan $text
   }
}
This is only an example, you can add any check you want in the mypub:seen proc.
s
simo
Revered One
Posts: 1107
Joined: Sun Mar 22, 2015 2:41 pm

Post by simo »

thank you CrazyCat that seems to work well
Post Reply