I have searched the tcl archive, and didn't really found what I needed.
What I want is, a script that will announce any given text I input, at a specific time, like announce an update which occours twice a day, first one at 00:00AM and second one at 12:00PM
The bot would then announce to the channel:
<bot> stuff has been updated, check it out at site.com
I dont want any public commands at all, if any commands at all, it should all be done via. partyline by me the botowner.
If this is too much to ask, and if this already exists, then I appologise for this topic.
# the chan to announce to
set do_on_time_chan "#chan"
bind time - "00 00 *" do_on_time
bind time - "00 12 *" do_on_time
proc do_on_time {args} {
putserv "PRIVMSG $::do_on_time_chan :stuff has been updated, check it out at site.com"
}
Looks like something I could use, but it looks really simple, maybe I really should read some more in the docs hehe, but thanks, so I can just add this, and it will announce whatever I put in the text?
*EDIT* would it be possible to make a .chanset #channel +announce kinda thing?
setudef flag announce
# the chan to announce to
set do_on_time_chan "#chan"
bind time - "00 00 *" do_on_time
bind time - "00 12 *" do_on_time
proc do_on_time {args} {
putserv "PRIVMSG $::do_on_time_chan :stuff has been updated, check it out at site.com"
}
I've read up on the udef section, and added setudef flag announce but i'm sure that was too easy, and that I need to do something else, although it did give me an output that that flag was set after I did .chanset #channel +announce
Why should I laugh? Everyone got to learn it sometime, and one of the best ways to do it is by asking, no shame in that
True, it's not as easy as that.. you have to check out the
channels
Returns: a list of the channels the bot has a channel record for
Module: channels
and
channel get <name> <setting>
Returns: The value of the setting you specify. For flags, a value of 0
means it is disabled (-), and non-zero means enabled (+).
Module: channels
along with the foreach command.. end-result should look something like this:
setudef flag announce
# the chan to announce to
set do_on_time_chan "#chan"
bind time - "00 00 *" do_on_time
bind time - "00 12 *" do_on_time
proc do_on_time {args} {
foreach ch [channels] {
if {[channel get $ch announce]} {
putserv "PRIVMSG $::do_on_time_chan :stuff has been updated, check it out at site.com"
}
}
}
But I was wondering, now that the userdef has been made, what about the static channel added in the script?
Could that part be removed, or should it be made to a different code?
since when does a time binding pass along channel information?
The way to accomplish it would be to use a custom flag with extended information. That way the message you put will be added during the .chanset
.
.chanset #yourchan +announce On channel #youchan we have lots of milk. Bring you kitties ladies. Thx.
Just like I have would be how you would enter your line, understand?
In this way, that static line containing channels is hereby irrelevant, and the chanset controls the universe...
edit: and actually, now that I really ponder about such a universe controlling announcer... I believe one might already exist in the archive, and rather than reinvent another wheel (the one made here might not be as round), it might be a smoother ride to just use the wheel already in existence... Just a thought
Im a bit confused now, so I can actually make a custom output for each channel in the .chanset or am I totally lost here? cause my future plan is to have the bot sit on several channels, but with custom output for each channel.
starpossen wrote:Im a bit confused now, so I can actually make a custom output for each channel in the .chanset or am I totally lost here? cause my future plan is to have the bot sit on several channels, but with custom output for each channel.
This _is_ BurgerKing..Indeed, you can have it your way. Which is exactly how I explained it above. During the .chanset is when you will set +announce and your message.
The script will use a timer, and that timer will sort thru every channel. If any are found to be +announce the script will grab the extended information and display it during that timered event. The display will be puthelp'd to avoid users from having this occur in so many channels the ircd dismisses their bot from the network for causing excess flood. This would be easy to accomplish and If no one else has ideas, I could have something up after 9-10 hours (I have work in 15 mins for 8 hours so can't delve into scripting yet mind you.. muahaha).. I'm sure as well someone else can script something according to the notes I've given.
.chanset #mychan +announce Robots are everywhere!!
.chanset #yourchan +announce There are no robots!!
**meanwhile 15 mins later**
*a timered event occurs in both channels*
<bot:#mychan> Robots are everywhere!!
<bot:#yourchan> There are no robots!!
This is more than likely what you had in mind.
Would def need a way to .backup announce and .load announce so bot crashes and such would not destroy any potential settings. This also is a trivial matter easily added.
Script by Papillon works as long as you make the change he posted. You enable it on a specific channel using .chanset #thechannel +announce. The message is hardcoded in the proc.
Speechles has a few nice suggestions, but have yet to post actual code.
Oh, and Speechles; time bindings would never supply a channel-name, but then again, the source of ch isn't from the proc arguments, but from a foreach-loop on the output of [channels] in this case...
speechles wrote:Would def need a way to .backup announce and .load announce so bot crashes and such would not destroy any potential settings. This also is a trivial matter easily added.
Trivial indeed, they made chansave for just such a thing.
Tnaks for all the replys, I think I got a better understanding of how things works now, I just got a tiny favor to ask, if I wanted to add minutes, would I just have to change it like