BeBot - An Anarchy Online and Age Of Conan chat automaton

Archive => Anarchy Online Archive => BeBot 0.4 support => Topic started by: kuznechik on August 17, 2007, 06:45:00 pm

Title: !news fix to show last headline out of blob
Post by: kuznechik on August 17, 2007, 06:45:00 pm
Well, I've got used to getting last headline out of blob so people can immediately see what's happening... So - lil addition...
Code: [Select]
--- News.php.orig       Tue Jul 31 16:36:26 2007
+++ News.php    Fri Aug 17 20:37:48 2007
@@ -105,6 +105,7 @@
                $this -> bot -> settings -> create ("News", "Raid_Add", "LEADER", "Who should be able to add raids", "ADMIN;LEADER;MEMBER;GUEST;ANONYMOUS");
                $this -> bot -> settings -> create ("News", "Raid_Del", "LEADER", "Who should be able to delete raids", "ADMIN;LEADER;MEMBER;GUEST;ANONYMOUS"
                $this -> bot -> settings -> create("News", "LogonSpam", FALSE, "Should the news be spammed to all buddies on their logon?");
+               $this -> bot -> settings -> create("News", "PrintLastHeadline", FALSE, "Should the last headline be shown out of blob?");

                $this -> help['description'] = 'Sets and shows headlines, news and raid events.';
                $this -> help['command']['news']="Shows current headlines and news";
@@ -216,6 +217,12 @@
                {
                        $newsdate = gmdate($this -> bot -> settings -> get("Time", "FormatString"), $val[1]);
                }
+               $result = $this -> bot -> db -> select("SELECT id, time, news  FROM #___news WHERE type = '2' ORDER BY id DESC LIMIT 0, 1");
+               if (!empty($result))
+               foreach ($result as $val)
+               {
+                       $lasthead = "<font color=CCInfoHeadline>" . $val[2] . "</font>";
+               }

                $result_headline = $this -> bot -> db -> select("SELECT id, time, name, news FROM #___news WHERE type = '2' ORDER BY time DESC LIMIT 0, 3");
                if (!empty($result_headline))
@@ -246,7 +253,11 @@
                        }
                        $inside .= "\n\n";
                }
+               if ($this -> bot -> settings -> get("News", "PrintLastHeadline")) {
+                    return $lasthead . ":: " . $this -> bot -> make_blob("click to view other news", $inside); }
+               else {
                return "News last updated " . $newsdate . ":: " . $this -> bot -> make_blob("click to view", $inside);
+               }
        }
SimplePortal 2.3.7 © 2008-2024, SimplePortal