egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Custom userflags

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
keung
Voice


Joined: 30 Apr 2012
Posts: 5

PostPosted: Mon Apr 30, 2012 8:54 pm    Post subject: Custom userflags Reply with quote

I'm in the process of writing a script where I'd like to have custom flags for users on channels. This is a bot where most communication is done on the channels themselves. The users I'd like to have as owners of channels will not be owners in the traditional way where they have access to add more users or alter anyone's flags, but rather have access to more commands than a regular user. To accomplish this I suppose I have to use custom flags, but is there anything I have to manipulate to make the bot recognize these flags?

From what I see on this page (is this the complete set of flags?), the flag i would be available.

.chattr user +i #examplechannel

And then

bind pub "n|i" !ownercommand some_proc_for_channelowners_only

Would this suffice? Also, how could I make sure that the bind only triggers for users that has that specific flag, and not trigger for any global flag?
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Mon Apr 30, 2012 11:51 pm    Post subject: Re: Custom userflags Reply with quote

keung wrote:

...
From what I see on this page (is this the complete set of flags?), the flag i would be available.


It probably is.

Try:
.help whois
in the partyline, to have the bot give you a list of flags.

Note this line, from there:
Quote:

There are also 26 user-defined channel flags (A-Z).


To conform to that, when I do it, I use an UPPER CASE flag.

Quote:

.chattr user +i #examplechannel

And then

bind pub "n|i" !ownercommand some_proc_for_channelowners_only

Would this suffice? Also, how could I make sure that the bind only triggers for users that has that specific flag, and not trigger for any global flag?


That would trigger for global owners and also those with channel flag "i".
Reference: http://suninet.the-demon.de/041.htm

I'm not real sure of what you are wanting to do, but it seems that if you did something like
.chattr user +I #channel
for every user, including yourself, that you wanted to be able to use the proc, ... wouldn't that do it?
Then bind like this:
bind -|I "!specialcommand" proc_for_those_with_I
Back to top
View user's profile Send private message
keung
Voice


Joined: 30 Apr 2012
Posts: 5

PostPosted: Tue May 01, 2012 12:50 am    Post subject: Reply with quote

Oh, I forgot for a second that flags were case sensitive and that A-Z could be used as well. Knowing this makes it a whole lot easier!

With the bind -|I, wouldn't that mean that anyone who is added to the bot with global flags could run the command? Come to think of it, it shouldn't really matter, I could just do an if statement to exclude anyone who doesn't have the +I flag from executing the command.

But, yes, you got what I meant. .chattr user +I #channel is in essence what I want to do. I was just a little unsure that it would really be that easy!
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Tue May 01, 2012 1:01 am    Post subject: Reply with quote

keung wrote:
Oh, I forgot for a second that flags were case sensitive and that A-Z could be used as well. Knowing this makes it a whole lot easier!


Smile

Quote:

With the bind -|I, wouldn't that mean that anyone who is added to the bot with global flags could run the command?


What global flags?
... not sure what you mean...

(Have you examined : http://suninet.the-demon.de/041.htm yet? )

Quote:

Come to think of it, it shouldn't really matter, I could just do an if statement to exclude anyone who doesn't have the +I flag from executing the command.


umm.... that's the purpose of flags in the bind... so you don't have to do that.

Quote:

But, yes, you got what I meant. .chattr user +I #channel is in essence what I want to do. I was just a little unsure that it would really be that easy!


Do some experimenting.
Carefully, to be sure you get the results you want.
Back to top
View user's profile Send private message
keung
Voice


Joined: 30 Apr 2012
Posts: 5

PostPosted: Wed May 02, 2012 11:00 am    Post subject: Reply with quote

Say that I have

bind -|I "!something" do_something

Doesn't the - imply that anyone can run the command, despite not having the +I flag on the channel? Or does that tell the eggdrop that only users with the flag can run the command?
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Wed May 02, 2012 11:43 am    Post subject: Reply with quote

keung wrote:
Say that I have

bind -|I "!something" do_something

Doesn't the - imply that anyone can run the command, despite not having the +I flag on the channel? Or does that tell the eggdrop that only users with the flag can run the command?


willyw wrote:

Do some experimenting.
Carefully, to be sure you get the results you want.



Here... try this:
Code:


# May 2, 2012

# http://forum.egghelp.org/viewtopic.php?p=99315#99315


bind pub -|I "!something" do_something

proc do_something {nick uhost handle chan text} {

   putserv "privmsg $chan :Bind triggered the proc"

}



Load that, and see what you get when you try it.
Experiment with setting global +I on yourself, and removing it.
Experiment with setting channel specific +I on yourself and removing it.

After every attempt to trigger the bind, do:
.binds *something*
in the partyline, and note the hit counter, too.

For myself, I found that I had to have the channel specific +I, to have bind trigger... which is what I expected. Smile


I hope this helps.
Back to top
View user's profile Send private message
speechles
Revered One


Joined: 26 Aug 2006
Posts: 1398
Location: emerald triangle, california (coastal redwoods)

PostPosted: Wed May 02, 2012 1:04 pm    Post subject: Reply with quote

keung wrote:
Say that I have

bind -|I "!something" do_something

Doesn't the - imply that anyone can run the command, despite not having the +I flag on the channel? Or does that tell the eggdrop that only users with the flag can run the command?


The - is a placeholder, to tell the interpreter to check for negative flags. But you've given it no flags to -. So basically, all that does is nothing. "-|+o" == "|+o" == "+|+o". Basically you have "GLOBAL|CHANNEL" in regard to flags. If I want to check if someone is owner of the bot itself "n|-" or "n|" or "n|+" would do that. If I want to check if someone is owner of an irc channel "-|n" or "|n" or "+|n" would do that.
_________________
speechles' eggdrop tcl archive
Back to top
View user's profile Send private message
keung
Voice


Joined: 30 Apr 2012
Posts: 5

PostPosted: Fri May 04, 2012 8:40 pm    Post subject: Reply with quote

Thanks for clearing this up! This thread went a little further than I expected. I actually don't have a bot running - yet Embarassed - so I haven't been able to play much with bind. I'm just writing a lot of code in a tcl file and running it through a shell to test it before I put it on an actual eggdrop, as I find it much more convenient to bugtest it that way.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber