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 

BogusTrivia - only ops start/stop trivia

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Support & Releases
View previous topic :: View next topic  
Author Message
garlic641
Voice


Joined: 04 Oct 2015
Posts: 3

PostPosted: Sun Oct 04, 2015 11:33 am    Post subject: BogusTrivia - only ops start/stop trivia Reply with quote

Hi,
I'm using BogusTrivia for my channel.
I want to set it so only channel operators can stop/start a game.

In t2-settings.tcl , so far I have:

Code:
set t2(oflag) "o|o"   ;# flags to turn the game on ("" = everyone) #
set t2(sflag) ""      ;# flags to turn game off    ("" = same as on flags) #


What flag(s) do I need to set for the desired result?
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Sun Oct 04, 2015 12:11 pm    Post subject: Reply with quote

That is the correct flags settings to allow only channel and global ops to use the on/off commands.

BogusTrivia is an eggdrop script, and the script/bot expects you to add your ops to the internal eggdrop user list.

The script does not look at the channel to see if anyone has +o in the channel.

With a few simple script hacks, Bogus could be made to look at the channel status of a user that is trying to turn the script on/off.
If you think you can safely modify the script code, I will work up a hack to check for +o in the channel. Let me know if you're interested.
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
garlic641
Voice


Joined: 04 Oct 2015
Posts: 3

PostPosted: Sun Oct 04, 2015 2:26 pm    Post subject: Reply with quote

Thanks for your reply.

Right now, I can stop/start the trivia script even without being opped; but that's probably because the Eggdrop bot already recognizes me as the owner of the bot, right?

If so, how can I add friends to the 'op user list' of Eggdrop so they can also start/stop the trivia bot? Is it with the .adduser command? If so, that's probably too much control for just starting/stopping a trivia script.



SpiKe^^ wrote:
That is the correct flags settings to allow only channel and global ops to use the on/off commands.

BogusTrivia is an eggdrop script, and the script/bot expects you to add your ops to the internal eggdrop user list.

The script does not look at the channel to see if anyone has +o in the channel.

With a few simple script hacks, Bogus could be made to look at the channel status of a user that is trying to turn the script on/off.
If you think you can safely modify the script code, I will work up a hack to check for +o in the channel. Let me know if you're interested.
Back to top
View user's profile Send private message
willyw
Revered One


Joined: 15 Jan 2009
Posts: 1175

PostPosted: Sun Oct 04, 2015 3:17 pm    Post subject: Reply with quote

garlic641 wrote:
Thanks for your reply.

Right now, I can stop/start the trivia script even without being opped; but that's probably because the Eggdrop bot already recognizes me as the owner of the bot, right?


Being owner of the bot includes many flags. One of them matches that which you have configured for the start/stop flags in the script.
Most likely, you have the o flag.

Quote:

If so, how can I add friends to the 'op user list' of Eggdrop so they can also start/stop the trivia bot? Is it with the .adduser command? If so, that's probably too much control for just starting/stopping a trivia script.


.adduser is one way, yes. .
+user is the other, but then you must add the user's hostmask yourself.
.adduser will add it automatically (but you should still inspect it, to be sure it is not too broad.)

As for the side effect of adding too much other control:
You can make up your own flags, if you like. Just use UPPER case.
If you wish, you could then have a flag that does nothing else, other than what you configure for it, in BogusTrivia.

See:
http://www.egghelp.org/commands/index.htm

Some specific commands to see there:
http://www.egghelp.org/commands/core.htm#whois
Use this command to view your own account in bot, and see your current flags. Also, you can get a list of all the pre-configured user attribute flags in Eggdrop.

http://www.egghelp.org/commands/irc.htm#adduser
http://www.egghelp.org/commands/core.htm#chattr
http://www.egghelp.org/commands/core.htm#+user
http://www.egghelp.org/commands/core.htm#+host

http://www.egghelp.org/commands/core.htm#help
This one is VERY useful. You would do yourself a favor, to get the hang of using it. I use it all the time. Smile
_________________
For a fun (and popular) Trivia game, visit us at: irc.librairc.net #science-fiction . Over 300K Q & A to play in BogusTrivia !
Back to top
View user's profile Send private message
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 792
Location: Tennessee, USA

PostPosted: Sun Oct 04, 2015 8:33 pm    Post subject: Reply with quote

For the commands to add your ops to the eggdrop internal user list, follow the links provided by willyw above.
That would make the script work as it is intended, starting/stopping for any user with an o flag in the user file.


If you would like to make the on/off commands available to only those that are currently opped (have +o) in the channel, that requires a little script editing...

1) In the t2-settings.tcl file, you would have to make the on/off commands trigger for everyone...
Code:
set t2(oflag) ""   ;# flags to turn the game on ("" = everyone) #
set t2(sflag) ""   ;# flags to turn game off    ("" = same as on flags) #


2) Then you would have to make the script check if the user triggering the on/off command is opped in the channel or not.

In the t-2.tcl file, search for this string...
Code:
proc TOnOff

On or about line 1854 you should find these 2 lines...
Code:
proc TOnOff {nk uh hn ch tx {from 0} } {  global t2 tclr botnick nick
 if {![file exists $t2(sfpath)t2.settings]} {  set temp [TSetup $nk $uh $hn 1 1]

You will need to add a line between those 2 lines that will check if the user is opped in the channel, and not reply if they aren't.
Make the script read more like this...
Code:
proc TOnOff {nk uh hn ch tx {from 0} } {  global t2 tclr botnick nick
 if {$from=="0" && ![isop $nk $ch]} {  return 0  }
 if {![file exists $t2(sfpath)t2.settings]} {  set temp [TSetup $nk $uh $hn 1 1]

_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
or visit the New Tcl Acrhive at www.tclarchive.org
.
Back to top
View user's profile Send private message Visit poster's website
garlic641
Voice


Joined: 04 Oct 2015
Posts: 3

PostPosted: Mon Oct 05, 2015 10:40 am    Post subject: Reply with quote

All answers were very helpful, thanks.

Also: thanks SpiKe^^ for the time and dedication you've put into BogusTrivia.
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 -> Script Support & Releases 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