| View previous topic :: View next topic |
| Author |
Message |
starpossen Op
Joined: 10 Jan 2006 Posts: 139
|
Posted: Thu May 08, 2008 5:05 pm Post subject: Announce at specific time |
|
|
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. |
|
| Back to top |
|
 |
Papillon Owner

Joined: 15 Feb 2002 Posts: 724 Location: *.no
|
Posted: Thu May 08, 2008 5:56 pm Post subject: |
|
|
| Code: | # 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"
} | something like this? _________________ Elen sila lúmenn' omentielvo |
|
| Back to top |
|
 |
starpossen Op
Joined: 10 Jan 2006 Posts: 139
|
Posted: Thu May 08, 2008 6:24 pm Post subject: |
|
|
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? |
|
| Back to top |
|
 |
Papillon Owner

Joined: 15 Feb 2002 Posts: 724 Location: *.no
|
Posted: Fri May 09, 2008 6:15 am Post subject: |
|
|
I would suggest you take a look in the tcl-command.doc file yes.. really helpful
to get the +announce I would suggest searching for setudef in the mentioned file _________________ Elen sila lúmenn' omentielvo |
|
| Back to top |
|
 |
starpossen Op
Joined: 10 Jan 2006 Posts: 139
|
Posted: Fri May 09, 2008 9:27 am Post subject: |
|
|
Okay, please don't laugh to much now, but would this be somewhat close to my sollution:
| Code: |
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 |
|
| Back to top |
|
 |
Papillon Owner

Joined: 15 Feb 2002 Posts: 724 Location: *.no
|
Posted: Fri May 09, 2008 9:50 am Post subject: |
|
|
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 | Quote: | channels
Returns: a list of the channels the bot has a channel record for
Module: channels | and | Quote: | 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:
| Code: | 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"
}
}
}
|
_________________ Elen sila lúmenn' omentielvo |
|
| Back to top |
|
 |
starpossen Op
Joined: 10 Jan 2006 Posts: 139
|
Posted: Fri May 09, 2008 9:58 am Post subject: |
|
|
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? |
|
| Back to top |
|
 |
Papillon Owner

Joined: 15 Feb 2002 Posts: 724 Location: *.no
|
Posted: Fri May 09, 2008 10:10 am Post subject: |
|
|
haha, my bad,.. that can offcourse be removed now and be replaced by _________________ Elen sila lúmenn' omentielvo |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Fri May 09, 2008 10:15 am Post subject: |
|
|
| Papillon wrote: | | haha, my bad,.. that can offcourse be removed now and be replaced by |
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
. | Quote: | .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 |
|
| Back to top |
|
 |
starpossen Op
Joined: 10 Jan 2006 Posts: 139
|
Posted: Fri May 09, 2008 10:31 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
speechles Revered One

Joined: 26 Aug 2006 Posts: 1398 Location: emerald triangle, california (coastal redwoods)
|
Posted: Fri May 09, 2008 10:38 am Post subject: |
|
|
| 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.
| Quote: | .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. |
|
| Back to top |
|
 |
nml375 Revered One
Joined: 04 Aug 2006 Posts: 2857
|
Posted: Fri May 09, 2008 11:22 am Post subject: |
|
|
Maybe time to clear up the mess? :p
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... _________________ NML_375, idling at #eggdrop@IrcNET |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Fri May 09, 2008 11:34 am Post subject: |
|
|
| 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. |
|
| Back to top |
|
 |
DragnLord Owner

Joined: 24 Jan 2004 Posts: 711 Location: C'ville, Virginia, USA
|
Posted: Fri May 09, 2008 11:41 am Post subject: |
|
|
| Code: | setudef flag announce
setudef str announce.msg
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 $ch :[channel get $ch announce.msg]"
}
}
} |
Usage:
.chanset #channel +announce
.chanset #channel announce.msg This is the message
.chansave |
|
| Back to top |
|
 |
starpossen Op
Joined: 10 Jan 2006 Posts: 139
|
Posted: Fri May 09, 2008 1:21 pm Post subject: |
|
|
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
| Code: |
bind time - "00 00 01*" do_on_time
bind time - "00 12 01*" do_on_time
|
Reason being that my bot is a bit ahead of time, and then I wanted it to wait till one minute past the hour in the script, as I showed in the code. |
|
| Back to top |
|
 |
|