PtokaX forum

Archive => Archived 5.1 boards => Finished Scripts => Topic started by: st0ne-db on 27 September, 2006, 05:00:42

Title: Cron.Bot.v1.3.LUA5.X-PtokaX
Post by: st0ne-db on 27 September, 2006, 05:00:42
Cron Bot is an admin tool that allows you to schedule events.
Based off Cron for Linux.

Types of Events that can be scheduled:

-[ Change Log v1.3 ]-

- Fixed, Improved error reporting for the Lua event
- Added, More Special Tags, See 'intro-demo.txt'
- Added, 'Cron Task' [OpProtection.lua] Match Op Client IP's to DNS or Static IP's
- Added, 'Cron Task' [GTime.lua] Time According To Google

-[ Change Log v1.2 ]-

- Fixed, Problems with trigger times and comma seperated number lists
- Fixed, Web page parsing for Lua 5.1 users ( Thx. Toobster )
- Added, Improved logging and reporting
- Added, Cronview filters
- Added, Lua event Special Tags
- Added, Lua task silent operation
- Added, Extended information returned about incorrect crontab commands
- Added, More right-click commands
- Added, 'Cron Task' [HublistVote.lua] Prompt users to vote at Hublist.org ( Requested by: Toobster )
- Added, 'Cron Task' [BotProtection.lua] Bot Protection/Blacklist
- Added, 'Cron Task' [LogRotation.lua] Cron Log Rotation
- Added, 'Cron Task' [CronTriggers.lua] Cron event to display all cron triggers
- Added, 'Cron Task' [NewPosts.lua] Cron event to display new posts on lua.uknnet.com
- Added, 'Cron Task' [EztvPosts.lua] Cron event to display new releases on eztv website

This bot requires PXLuaSockets. Some of the documentation is included in this post to provide detailed information about what this bot is capable of.

Download (http://the-westside.no-ip.info/request.php?30)



==========================================================================
Summarized Help for Cron:
==========================================================================

===================
l  Bot Commands:  l
------------------/

!crontab ---- Schedule an Event
!croned ---- Edit a Scheduled Event
!crondel ---- Delete a Scheduled Event
!cronview ---- View a Users Crontab
!cron ---- Enable/Disable Cron Items
!cronfile ---- Create a File for Cron
!cronexe ---- Force a Cron Event to run
!cronman ---- Cron Manual

For help on a specific command Type: !cronman <command>

ex. For detailed information about crontab:

!cronman crontab


====================================
Entering Commands:
====================================

You can enter commands in main or in a pm to the Cron bot.




==========================================================================
Summarized Syntax for Crontab Command:
==========================================================================

!crontab <trigger> <event>


====================================
Trigger Format:
====================================


==================
l Time Format:   l
-----------------/

Position    l    Match Time l   Accepted Range (* = match any)
------------+--------------------+---------------------------------
      1     l Min: l     * or 0-59,
      2     l Hour: l     * or 0-23,
      3     l Day: l     * or 1-31,
      4     l Month: l     * or 1-12,
      5     l Day of Week: l     * or 0-6, (sun=0,mon=1,...sat=6)
     

There are 5 parts to the trigger:

- A complete trigger will look like this:
   
0 21 * * 0 = 21:00 hour, on the 0 min, on Sunday                                         
20 * 4,16 * * = Any day at 4:00 and 16:00 hour, on the 20th min
0 4,6,8 * * * = Any day at 4:00, 6:00 and 8:00 hour, on the 0 min

- You may not have all wildcards:

ex. * * * * *

========================
l Connection Format:   l
-----------------------/

Trigger an event from:

- Connecting User   : enter the letter 'c' for all trigger times.

ex. c c c c c

- Disconnecting User: enter the letter 'd' for all trigger times. 

ex. d d d d d

- OnError events    : enter the letter 'e' for all trigger times.

ex. e e e e e

- To only trigger when a specific username connects or disconnects:
   Enter the nick in the Day of Week term

ex.  c c c c NICK  <-- Trigger on connection of NICK only
ex.  d d d d NICK  <-- Trigger on disconnection of NICK only

====================================
Event Format:
====================================


=========================
l  Available Events:    l
------------------------/

text - broadcast message's [sent from the cron bot]
msg - send messages [from any user(s)]
lua - run lua chunks
http - retrieve and display rss feeds and web content
email - send email messages to user(s)
ftp-put - put a txt file onto a ftp site
ftp-get - read a txt file from a ftp site
ftp-dir - fetch a directory listing from a ftp site
host - host pinger


====================
l Event Format:    l
-------------------/

When a username or profile name is used the bot defaults to send a PM

- main:[user] [message]

[message] can be:
message or filename

[user] can be:
all
profile name
username or {user} for connection event
or filename with lists of usernames or profile names


- pm:[user] [message]

[message] can be:
message or filename

[user] can be:
all
profile name
username or {user} for connection event
or filename with lists of usernames or profile names


- msg:[username] [user]:[message]

[message] can be:
message or filename

[username] can be:
nick to send message as

[user] can be:
all
pm-all
profile name
username or {user} for connection event
or filename with lists of usernames or profile names


- lua:[file] [user]:[optional]

[file] can be:
any lua filename <file.lua> that returns 2 variables:

1 - a string (the output of your script)
2 - an error code (0=execute, [>0 or "error description"]=fail)

view cron/ProfileTotals.lua for more information

[user] can be:
all
pm-all
profile name
username or {user} for connection event
filename with lists of usernames or profile names
pm:[optional]
main:[optional]

[optional] can be:
profile name
username or {user} for connection event
filename with lists of usernames or profile names


- http:[user] www.somesite.com/somefile.ext

[user] can be:
all
pm-all
profile name
username or {user} for connection event
or filename with lists of usernames or profile names


- email:[email] [message]

[message] can be:
message or filename

[email] can be:
email address
or filename with lists email addresses


- ftp-put:[file] username:password@www.ftpsite.com/folder/filename.ext

[file] can be:
filename


- ftp-get:[user] username:password@www.ftpsite.com/folder/filename.ext

[user] can be:
all
pm-all
profile name
username or {user} for connection event
or filename with lists of usernames or profile names


- ftp-dir:[user] username:password@www.ftpsite.com/folder/

[user] can be:
all
pm-all
profile name
username or {user} for connection event
or filename with lists of usernames or profile names


- host:[user] www.somesite.com

[user] can be:
all
pm-all
profile name
username or {user} for connection event
or filename with lists of usernames or profile names


====================
l  Special Tags:   l
-------------------/

You can use these special tags in messages only when the username
or profile is given. They will be replaced with the appropriate info..

- Connection and Disconnection:

{user} = users nick
(profile} = users profile
(share) = users share size
{slots} = users slots
{desc} = users description
{email} = users email

- Error:

{error} = error message


====================================
Putting it all together:
====================================

- A cron command to pm an advert(advert.txt) to everyone on the 0 min,
  every hour, every day, every month, any day of week. (once an hr)

!crontab 0 * * * * pm:all advert.txt


- A cron command to ping hub's listed in a file called hubs.txt
  at 00:30 and 12:30 and pm the info to only to the users in the file user.txt.

!crontab 30 0,12 * * * host:user.txt hubs.txt


- A cron command to pm a message in main to all connecting users..
  (replace NICK with your nick)

!crontab c c c c c msg:NICK pm:Hello {user}, welcome to the hub.


- A cron command to PM intro.txt to all connecting users

!crontab c c c c c main:{user} intro.txt


- A cron command to run the lua script 'profiletotals.lua' which
  returns a message with user totals by profile name, and sends to only the
  profile of Operators every sunday at 14:25, in main chat.

!crontab 25 14 * * 0 lua:profiletotals.lua main:Operator

Title: Re: Cron.Bot.v1.1.LUA5.X-PtokaX
Post by: st0ne-db on 30 September, 2006, 11:33:45
Version 1.1 is available.. a few fixes and additions.

Download (http://the-westside.no-ip.info/request.php?30)
Title: Re: Cron.Bot.v1.1.LUA5.X-PtokaX
Post by: zvamp on 02 October, 2006, 19:57:18
Nice script!!

But I am only interested in the RSS function, is there any RSS only script that will work for Lua5.1.x??
Title: Re: Cron.Bot.v1.2.LUA5.X-PtokaX
Post by: st0ne-db on 04 October, 2006, 03:15:05
Edited 1st post.. or download (http://the-westside.no-ip.info/request.php?30)
Title: Re: Cron.Bot.v1.3.LUA5.X-PtokaX
Post by: st0ne-db on 30 October, 2006, 21:25:15
New Version 1.3, Edited 1st post.. or download (http://the-westside.no-ip.info)
Title: Re: Cron.Bot.v1.3.LUA5.X-PtokaX
Post by: gizmo on 22 November, 2006, 08:53:53
The link not working =(
Title: Re: Cron.Bot.v1.3.LUA5.X-PtokaX
Post by: Stormbringer on 22 November, 2006, 15:02:28
http://the-westside.no-ip.info/downloads.php?cat_id=3&download_id=17