Login
Username: Password:
Remember me

[Sign Up] / [Recover Password]

Theme / Language

Popular
New Torrents
new name
Size: 18.40 MB
Most active
new name
S: 74 L: 3
New Posters
Shoutbox Event Bot
Controls ·  Search New posts · Mark unread

You are in: Forum / Forum / Torrent Trader / v3 Mods in Progress

2020-05-15 09:08:10
Just a place to compile changes and release to "completed mods".

What this does:

It utilizes /backend/cleanup.php to trigger message events to the Shoutbox. While cleanup performs the same, it pushes updates to the Shoutbox too, such as:

- Total seeders today (private torrents)
- We have 27 comments on 33 torrents today
- Cleaning peers. Stale for 15 minutes.
- Auto Leech has been warned for Username
- Auto Leech ban has been lifted for Username
- There are 16 peers on the tracker today

Thats what I have so far, keeping in mind this is important so your shoutbox doesn't become bombed:

$site_config['autoclean_interval']         = '300'; // 300 = 5 minutes (seconds)


Seems to be "okay", but still too often. Adjust this config to reduce the hammering of tracker updates. Set to 5 minutes. Use google to calculate minutes to seconds.

So I assigned the "user" of shout to be a Bot account made and restricted for just this. Works well. Another UNIT3D rip.
I'm surprised this wasn't default functionality. Seems to be the way on modern sites.

Open /backend/cleanup.php

Find:

$res = SQL_Query_exec("SELECT torrent, seeder, COUNT(*) AS c FROM peers GROUP BY torrent, seeder");

Add under:

// Send to Shoutbox - Total seeders today
$getcount = mysql_fetch_assoc($res);
$seeders = $getcount["c"];
$event = "There are $seeders Private Seeders Today!";
SQL_Query_exec("INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, 'NerbBot', '$event', NOW(), 0)");

Find:

$res = SQL_Query_exec("SELECT torrent, COUNT(torrent) as c FROM comments WHERE torrent > 0 GROUP BY torrent");

Add under:

// Send to Shoutbox - Total comments posted
$getcount = SQL_Query_exec("SELECT COUNT(torrent) as c FROM comments");
$restotal = mysql_fetch_assoc($getcount);
$commcount = $restotal["c"];
$event = "Currently there are $commcount comments posted";
SQL_Query_exec("INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, 'NerbBot', '$event', NOW(), 0)");

Find:

SQL_Query_exec("UPDATE torrents SET visible='no' WHERE visible='yes' AND last_action < FROM_UNIXTIME($deadtime) AND seeders = '0' AND leechers = '0' AND external !='yes'");

Add under:

// Send to Shoutbox Bot - May 15, 2020
$thedate = time_ago($site_config["max_dead_torrent_time"]);
$logged = str_replace('ago', '', $thedate);
$event = "Torrent dead for $logged Sending to graveyard.";
SQL_Query_exec("INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, 'NerbBot', '$event', NOW(), 0)");

Find:

SQL_Query_exec("INSERT INTO messages (sender, receiver, added, msg, poster, subject) VALUES ('0', '".$arr["id"]."', '".$timenow."', '".$reason."', '0', 'Warning: Poor Ratio')");

Add under:

// Send to Shoutbox - Low ratio warning
$warneduser = $arr["username"];
$event = "Auto Leech warning has been added for $warneduser";
SQL_Query_exec("INSERT INTO shoutbox (msgid, user, message, date, userid) VALUES (NULL, 'NerbBot', '$event', NOW(), 0)");


I believe SQL escape is in order - advise?

Now you need to make an account dedicated for this, use the username you want and modify the INSERT statements --- or just register with NerbBot as username.
2020-05-15 10:17:44
Nice mod m8, some would advise to escape but at a glance I dont think its necessary.
You should be able to trust the bots input it's just collecting data from cleanup
2020-05-15 11:08:51
"m-jay, post: 68578, member: 20288":

Nice mod m8, some would advise to escape but at a glance I dont think its necessary.
You should be able to trust the bots input it's just collecting data from cleanup


Much of the code has been reduced and improved. Once a final touch and a day to see it collect and post, I should know its all working as expected, then post ZIP.
Users online

No users online

Search



Statistics

    Torrents

  • Tracking: 3
  • Todays torrents: 0
  • Seeders: 0
  • Leechers: 0
  • Peers: 0
  • Downloaded: 89.96 GB
  • Uploaded: 9.86 GB

  • Members

  • We have: 838
  • New today: 0
  • Guest today: 9

  • Online

  • Total online: 4
  • Members: 0
  • Guests online: 4
  • Comments: 3
  • Messages: 1,728