PtokaX forum

Archive => Archived 5.1 boards => Finished Scripts => Topic started by: bastya_elvtars on 27 July, 2007, 01:40:18

Title: Horoscope script
Post by: bastya_elvtars on 27 July, 2007, 01:40:18
It gets the daily horoscope from a site and fetches it.

It will open a DOS window at the script startup and every
24 hour afterwards. It counts the 24 hours from the startup.
I suppose that sites are updated every 24 hours.

Note that updating blocks the hub for 10 or more seconds.
This is currently unavoidable because there is nothing that
supports coding async socket operations.

Enjoy!
Title: Re: Horoscope script
Post by: jack_port1000 on 27 July, 2007, 07:45:15
tanx a lot
[10:55] Syntax ...T.JAGIRDAR\Desktop\New Folder (2)\scripts\zodiac.lua:39: bad argument #1 to 'gsub' (string expected, got nil)

little bugs there canu add right clike command like horoscope and all zodiac

sorry i prees by mistake notyfi tab sorry for tat
Title: Re: Horoscope script
Post by: sphinx_spb on 27 July, 2007, 10:35:18
It's already done by russians  ;)
I personally made allinone script for fetching info: weather (for all cities), goroscope, news, anecdots, bash.org.ru quotes, and currency rates. You can familiarize with this script on my hub, but of course all this info is russian. And it not blocks the hub and not opens DOS window.  ;D
Title: Re: Horoscope script
Post by: bastya_elvtars on 27 July, 2007, 10:43:22
Quote from: jack_port1000 on 27 July, 2007, 07:45:15
tanx a lot
[10:55] Syntax ...T.JAGIRDAR\Desktop\New Folder (2)\scripts\zodiac.lua:39: bad argument #1 to 'gsub' (string expected, got nil)

little bugs there canu add right clike command like horoscope and all zodiac

That error should only occur if you intentionally closed the DOS window or deleted files from the zodiac directory manually.

Quote from: sphinx_spb on 27 July, 2007, 10:35:18
It's already done by russians  ;)
I personally made allinone script for fetching info: weather (for all cities), goroscope, news, anecdots, bash.org.ru quotes, and currency rates. You can familiarize with this script on my hub, but of course all this info is russian. And it not blocks the hub and not opens DOS window.  ;D

How could you achieve that it doesn't block the hub?
Title: Re: Horoscope script
Post by: sphinx_spb on 27 July, 2007, 13:32:34
Quote from: bastya_elvtars on 27 July, 2007, 10:43:22
How could you achieve that it doesn't block the hub?
Because my script uses PxWSA and fetching info from RSS pages (also possible from html, but more difficult).
Title: Re: Horoscope script
Post by: bastya_elvtars on 27 July, 2007, 15:00:50
Quote from: sphinx_spb on 27 July, 2007, 13:32:34
Because my script uses PxWSA and fetching info from RSS pages (also possible from html, but more difficult).

I had problems with non-blocking socket features of PXWSA and its license disallows incorporation into script packs.
Title: Re: Horoscope script
Post by: jack_port1000 on 29 July, 2007, 10:25:26
bastya great work its working great but can u please add right clicke for this thing
Title: Re: Horoscope script
Post by: bastya_elvtars on 30 July, 2007, 01:11:00
Quote from: jack_port1000 on 29 July, 2007, 10:25:26
bastya great work its working great but can u please add right clicke for this thing

Sure, gimme 20 more minutes.
Updated the archive in the first post.
Title: Re: Horoscope script
Post by: elgee on 07 February, 2008, 16:18:28
is it possible to get the script updated to remove most of it in this lines:

QuoteCopyright (c)2008 Free Horoscope Daily * About Aquarius * Contact Us   var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));   var pageTracker = _gat._getTracker("UA-1984878-3"); pageTracker._initData(); pageTracker._trackPageview();   

:)
Title: Re: Horoscope script
Post by: bastya_elvtars on 07 February, 2008, 18:11:30
Updated zodiac.lua with my new HTML parser code. It works here.

Code (lua) Select
--[[
Zodiac bot by bastya_elvtars
It gets the daily horoscope from a site and fetches it.

It will open a DOS window at the script startup and every
24 hour afterwards. It counts the 24 hours from the startup.
I suppose that sites are updated every 24 hours.

Note that updating blocks the hub for 10 or more seconds.
This is currently unavoidable because there is nothing that
supports coding async socket operations.

You can configure the command and the bot below.
]]

command="horoscope"

Bot=
  {
    name="Zodiac",
    email="zodiac@localhost",
    desc="Horoscope bot"
  }

-- Source follows. Do not edit below.

nl = "\n"

function HTML_ToText (file)
  -- Declare variables, load the file. Make tags lowercase.
  local text
  local f=io.open (file)
  if f then
    if f:seek("end") <= 0 then return end
    f:seek("set")
    text = f:read ("*a")
    f:close()
  end
  text = string.gsub (text,"(<([^>]-)>)",function (str) return str:lower() end)
  --[[
  First we kill the developer formatting (tabs, CR, LF)
  and produce a long string with no newlines and tabs.
  We also kill repeated spaces as browsers ignore them anyway.
  ]]
  local devkill=
    {
      ["("..string.char(10)..")"] = " ",
      ["("..string.char(13)..")"] = " ",
      ["("..string.char(15)..")"] = "",
      ["(%s%s+)"]=" ",
    }
  for pat, res in pairs (devkill) do
    text = string.gsub (text, pat, res)
  end
  -- Then we remove the header. We do this by stripping it first.
  text = string.gsub (text, "(<%s*head[^>]*>)", "<head>")
  text = string.gsub (text, "(<%s*%/%s*head%s*>)", "</head>")
  text = string.gsub (text, "(<head>,*<%/head>)", "")
  -- Kill all scripts. First we nuke their attribs.
  text = string.gsub (text, "(<%s*script[^>]*>)", "<script>")
  text = string.gsub (text, "(<%s*%/%s*script%s*>)", "</script>")
  text = string.gsub (text, "(<script>,*<%/script>)", "")
  -- Ok, same for styles.
  text = string.gsub (text, "(<%s*style[^>]*>)", "<style>")
  text = string.gsub (text, "(<%s*%/%s*style%s*>)", "</style>")
  text = string.gsub (text, "(<style>.*<%/style>)", "")
 
  -- Replace <td> and <th> with tabulators.
  text = string.gsub (text, "(<%s*td[^>]*>)","\t")
  text = string.gsub (text, "(<%s*th[^>]*>)","\t")
 
  -- Replace <br> with linebreaks.
  text = string.gsub (text, "(<%s*br%s*%/%s*>)",nl)
 
  -- Replace <li> with an asterisk surrounded by spaces.
  -- Replace </li> with a newline.
  text = string.gsub (text, "(<%s*li%s*%s*>)"," *  ")
  text = string.gsub (text, "(<%s*/%s*li%s*%s*>)",nl)
 
  -- <p>, <div>, <tr>, <ul> will be replaced to a double newline.
  text = string.gsub (text, "(<%s*div[^>]*>)", nl..nl)
  text = string.gsub (text, "(<%s*p[^>]*>)", nl..nl)
  text = string.gsub (text, "(<%s*tr[^>]*>)", nl..nl)
  text = string.gsub (text, "(<%s*%/*%s*ul[^>]*>)", nl..nl)
   
  -- Some petting with the <a> tags. :-P
--   local addresses,c = {},0
--   text=string.gsub(text,"<%s*a.-href=[\'\"](%S+)[\'\"][^>]*>(.-)<%s*%/*%s*a[^>]->", -- gets URL from a tag, and the enclosed name
--   function (url,name)
--     c = c + 1
--     name = string.gsub (name, "<([^>]-)>","") -- strip name from tags (e. g. images as links)
--     
--     -- We only consider the URL valid if the name contains alphanumeric characters.
--     if name:find("%w") then print(url, name, c) table.insert (addresses, {url, name}) return name.."["..#addresses.."]" else return "" end   
--   end)

  -- Nuke all other tags now.
  text = string.gsub (text, "(%b<>)","")
 
  -- Replace entities to their correspondant stuff where applicable.
  -- C# is owned badly here by using a table. :-P
  -- A metatable secures entities, so you can add them natively as keys.
  -- Enclosing brackets also get added automatically (capture!)
  local entities = {}
  setmetatable (entities,
  {
    __newindex = function (tbl, key, value)
      key = string.gsub (key, "(%#)" , "%%#")
      key = string.gsub (key, "(%&)" , "%%&")
      key = string.gsub (key, "(%;)" , "%%;")
      key = string.gsub (key, "(.+)" , "("..key..")")
      rawset (tbl, key, value)
    end
  })
  entities =
  {
    ["&nbsp;"] = " ",
    ["&bull;"] = " *  ",
    ["&lsaquo;"] = "<",
    ["&rsaquo;"] = ">",
    ["&trade;"] = "(tm)",
    ["&frasl;"] = "/",
    ["&lt;"] = "<",
    ["&gt;"] = ">",
    ["&copy;"] = "(c)",
    ["&reg;"] = "(r)",
    -- Then kill all others.
    -- You can customize this table if you would like to,
    -- I just got bored of copypasting. :-)
    -- http://hotwired.lycos.com/webmonkey/reference/special_characters/
    ["%&.+%;"] = "",
  }
  for entity, repl in pairs (entities) do
    text = string.gsub (text, entity, repl)
  end
  text = text..nl..nl..("-"):rep(27)..nl..nl
 
--   for k,v in ipairs (addresses) do
--     text = text.."["..k.."] "..v[1]..nl
--   end
--   if #addresses > 0 then
--     text=text..nl:rep(2)..("-"):rep(2)..nl
--     for key, tbl in ipairs(addresses) do
--       text = text..nl.."["..key.."]"..tbl[1]
--     end
--   end
 
  return text
 
end

zodiac=
  {
    "aquarius",
    "aries",
    "cancer",
    "capricorn",
    "gemini",
    "leo",
    "libra",
    "pisces",
    "sagittarius",
    "scorpio",
    "taurus",
    "virgo"
  }
 
zodtbl={}
 
function FetchZodiacForToday()
  local loc=string.gsub(frmHub:GetPtokaXLocation(),"%/",[[\]]) -- We replace the / to \. Works around a PXLUA bug. :-P
  local x=os.clock()
  SendToAll(Bot.name,"Getting the fresh horoscope. This slows down the hub, so please be patient.") -- Get the batchfile created
  local f=io.open("zodiac/getpages.cmd","w+")
  f:write("@echo off\nREM This batch file is generated by the zodiac script.\nREM It will be overwritten on every update.\r\n")
  for _,val in ipairs (zodiac) do
    f:write(loc.."scripts\\zodiac\\wget.exe -O"..loc.."scripts\\zodiac\\"..val..".html http://www.freehoroscopedaily.com/"..val.."/\n")
  end
  f:close()

  os.execute (loc.."scripts\\zodiac\\getpages.cmd") -- Run it

  for _,sign in ipairs(zodiac) do -- Parse the HTML files. It is faster to do it right away.
    zodtbl[sign]=1
    local f=io.open("zodiac/"..sign..".txt","w+")
    f:write(HTML_ToText("zodiac/"..sign..".html"))
    f:close()
  end
 
  SendToAll(Bot.name,"\r\nHoroscope fetched. It took "..os.clock()-x.." seconds. Check your horoscope with "..frmHub:GetPrefixes()[1]..command.." <sign>\r\nType "..frmHub:GetPrefixes()[1]..command.." for help!")
end

function Main()
  frmHub:RegBot(Bot.name, 1, Bot.desc, Bot.email )
  FetchZodiacForToday() -- Get the thing.
  zodiac_rc=""
  for k, v in ipairs(zodiac) do
    zodiac_rc=zodiac_rc.."$UserCommand 1 3 Horoscope\\"..v.."$<%[mynick]> !"..command.." "..v.."&#124;|"
  end
  zodiac_rc=zodiac_rc:sub(1,-2)
  SetTimer (3600*60000) -- Fire a timer, it will tick every day.
  StartTimer()
end

OnTimer = FetchZodiacForToday -- OK, another day passed by, get the stuff again.

function ChatArrival(user,data) -- Usual stuff: command processing, sending the results
  local prf="[%"..table.concat(frmHub:GetPrefixes(), "%").."]"
  data = data:sub(1,-2)
  local cmd,sign = data:match("%b<>%s+"..prf.."(%S*)%s*(%S*)")
  if cmd == command then
    if not zodtbl[sign] then
      user:SendPM(Bot.name,"Usage: "..frmHub:GetPrefixes()[1]..command.." <sign>\r\nAvailable signs:\r\n"..("-"):rep(25).."\r\n"..table.concat(zodiac,"\r\n"))
    else
      local f=io.open("zodiac/"..sign..".txt","r")
      local contents = string.gsub(f:read("*a"),string.char(10), "\r\n")
      f:close()
      user:SendPM(Bot.name,"\r\n"..contents)
    end
    return 1
  end
end

function NewUserConnected(user)
  user:SendData(zodiac_rc)
end

OpConnected = NewUserConnected

--[[
Copyright (c) 2007, bastya_elvtars

All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice, this
      list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of the author nor the names of contributors may be used
      to endorse or promote products derived from this code without specific
      prior written permission.

THIS CODE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
CODE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

----------------------------------------------------------------------------------

This bot utilizes the GNU wget utiliy. That program is
licensed under the GPL. It is bundled with the script
and its source can be downloaded from:

http://www.gnu.org/software/wget/wget.html

The original binary is from:

http://users.ugent.be/~bpuype/wget/
]]
Title: Re: Horoscope script
Post by: elgee on 07 February, 2008, 22:58:23
It's working here as well.
Looking much better now so thank you for this :)
Title: Re: Horoscope script
Post by: massive on 11 October, 2012, 17:33:53
Hi, I have an error in my ptokax 0.4.1, shows me its:
Syntax ... ttrashe \ New Folder \ Ekzecutor \ scripts \ zodiac.lua: 226: attempt to call method 'SendData' (a nil value)

One solution, if you like it?
Title: Re: Horoscope script
Post by: ATAG on 14 October, 2012, 22:45:30
QuoteHoroscope script
? on: July 27, 2007, 01:40:18 am ?
You have to rewrite it, PtokaX has got new Lua API for years...
Title: Re: Horoscope script
Post by: PPK on 03 November, 2012, 10:42:32
 :P

--[[
Zodiac bot by bastya_elvtars
It gets the daily horoscope from a site and fetches it.

It will open a DOS window at the script startup and every
24 hour afterwards. It counts the 24 hours from the startup.
I suppose that sites are updated every 24 hours.

Note that updating blocks the hub for 10 or more seconds.
This is currently unavoidable because there is nothing that
supports coding async socket operations.

You can configure the command and the bot below.
]]

command="horoscope"

Bot=
  {
    name="Zodiac",
    email="zodiac@localhost",
    desc="Horoscope bot"
  }

-- Source follows. Do not edit below.

nl = "\n"

function HTML_ToText (file)
  -- Declare variables, load the file. Make tags lowercase.
  local text
  local f=io.open (file)
  if f then
    if f:seek("end") <= 0 then return end
    f:seek("set")
    text = f:read ("*a")
    f:close()
  end
  text = string.gsub (text,"(<([^>]-)>)",function (str) return str:lower() end)
  --[[
  First we kill the developer formatting (tabs, CR, LF)
  and produce a long string with no newlines and tabs.
  We also kill repeated spaces as browsers ignore them anyway.
  ]]
  local devkill=
    {
      ["("..string.char(10)..")"] = " ",
      ["("..string.char(13)..")"] = " ",
      ["("..string.char(15)..")"] = "",
      ["(%s%s+)"]=" ",
    }
  for pat, res in pairs (devkill) do
    text = string.gsub (text, pat, res)
  end
  -- Then we remove the header. We do this by stripping it first.
  text = string.gsub (text, "(<%s*head[^>]*>)", "<head>")
  text = string.gsub (text, "(<%s*%/%s*head%s*>)", "</head>")
  text = string.gsub (text, "(<head>,*<%/head>)", "")
  -- Kill all scripts. First we nuke their attribs.
  text = string.gsub (text, "(<%s*script[^>]*>)", "<script>")
  text = string.gsub (text, "(<%s*%/%s*script%s*>)", "</script>")
  text = string.gsub (text, "(<script>,*<%/script>)", "")
  -- Ok, same for styles.
  text = string.gsub (text, "(<%s*style[^>]*>)", "<style>")
  text = string.gsub (text, "(<%s*%/%s*style%s*>)", "</style>")
  text = string.gsub (text, "(<style>.*<%/style>)", "")
 
  -- Replace <td> and <th> with tabulators.
  text = string.gsub (text, "(<%s*td[^>]*>)","\t")
  text = string.gsub (text, "(<%s*th[^>]*>)","\t")
 
  -- Replace <br> with linebreaks.
  text = string.gsub (text, "(<%s*br%s*%/%s*>)",nl)
 
  -- Replace <li> with an asterisk surrounded by spaces.
  -- Replace </li> with a newline.
  text = string.gsub (text, "(<%s*li%s*%s*>)"," *  ")
  text = string.gsub (text, "(<%s*/%s*li%s*%s*>)",nl)
 
  -- <p>, <div>, <tr>, <ul> will be replaced to a double newline.
  text = string.gsub (text, "(<%s*div[^>]*>)", nl..nl)
  text = string.gsub (text, "(<%s*p[^>]*>)", nl..nl)
  text = string.gsub (text, "(<%s*tr[^>]*>)", nl..nl)
  text = string.gsub (text, "(<%s*%/*%s*ul[^>]*>)", nl..nl)
   
  -- Some petting with the <a> tags. :-P
--   local addresses,c = {},0
--   text=string.gsub(text,"<%s*a.-href=[\'\"](%S+)[\'\"][^>]*>(.-)<%s*%/*%s*a[^>]->", -- gets URL from a tag, and the enclosed name
--   function (url,name)
--     c = c + 1
--     name = string.gsub (name, "<([^>]-)>","") -- strip name from tags (e. g. images as links)
--     
--     -- We only consider the URL valid if the name contains alphanumeric characters.
--     if name:find("%w") then print(url, name, c) table.insert (addresses, {url, name}) return name.."["..#addresses.."]" else return "" end   
--   end)

  -- Nuke all other tags now.
  text = string.gsub (text, "(%b<>)","")
 
  -- Replace entities to their correspondant stuff where applicable.
  -- C# is owned badly here by using a table. :-P
  -- A metatable secures entities, so you can add them natively as keys.
  -- Enclosing brackets also get added automatically (capture!)
  local entities = {}
  setmetatable (entities,
  {
    __newindex = function (tbl, key, value)
      key = string.gsub (key, "(%#)" , "%%#")
      key = string.gsub (key, "(%&)" , "%%&")
      key = string.gsub (key, "(%;)" , "%%;")
      key = string.gsub (key, "(.+)" , "("..key..")")
      rawset (tbl, key, value)
    end
  })
  entities =
  {
    ["&nbsp;"] = " ",
    ["&bull;"] = " *  ",
    ["&lsaquo;"] = "<",
    ["&rsaquo;"] = ">",
    ["&trade;"] = "(tm)",
    ["&frasl;"] = "/",
    ["&lt;"] = "<",
    ["&gt;"] = ">",
    ["&copy;"] = "(c)",
    ["&reg;"] = "(r)",
    -- Then kill all others.
    -- You can customize this table if you would like to,
    -- I just got bored of copypasting. :-)
    -- http://hotwired.lycos.com/webmonkey/reference/special_characters/
    ["%&.+%;"] = "",
  }
  for entity, repl in pairs (entities) do
    text = string.gsub (text, entity, repl)
  end
  text = text..nl..nl..("-"):rep(27)..nl..nl
 
--   for k,v in ipairs (addresses) do
--     text = text.."["..k.."] "..v[1]..nl
--   end
--   if #addresses > 0 then
--     text=text..nl:rep(2)..("-"):rep(2)..nl
--     for key, tbl in ipairs(addresses) do
--       text = text..nl.."["..key.."]"..tbl[1]
--     end
--   end
 
  return text
 
end

zodiac=
  {
    "aquarius",
    "aries",
    "cancer",
    "capricorn",
    "gemini",
    "leo",
    "libra",
    "pisces",
    "sagittarius",
    "scorpio",
    "taurus",
    "virgo"
  }
 
zodtbl={}
 
function FetchZodiacForToday()
  local loc=string.gsub(Core.GetPtokaXPath(),"%/",[[\]]) -- We replace the / to \. Works around a PXLUA bug. :-P
  local x=os.clock()
  Core.SendToAll("<"..Bot.name.."> Getting the fresh horoscope. This slows down the hub, so please be patient.|") -- Get the batchfile created
  local f=io.open(Core.GetPtokaXPath().."scripts/zodiac/getpages.cmd","w+")
  f:write("@echo off\nREM This batch file is generated by the zodiac script.\nREM It will be overwritten on every update.\r\n")
  for _,val in ipairs (zodiac) do
    f:write(loc.."scripts\\zodiac\\wget.exe -O"..loc.."scripts\\zodiac\\"..val..".html http://www.freehoroscopedaily.com/"..val.."/\n")
  end
  f:close()

  os.execute (loc.."scripts\\zodiac\\getpages.cmd") -- Run it

  for _,sign in ipairs(zodiac) do -- Parse the HTML files. It is faster to do it right away.
    zodtbl[sign]=1
    local f=io.open(Core.GetPtokaXPath().."scripts/zodiac/"..sign..".txt","w+")
    f:write(HTML_ToText("scripts/zodiac/"..sign..".html"))
    f:close()
  end
 
  Core.SendToAll("<"..Bot.name.."> \r\nHoroscope fetched. It took "..os.clock()-x.." seconds. Check your horoscope with "..string.sub(SetMan.GetString(29),1,1)..command.." <sign>\r\nType "..
      string.sub(SetMan.GetString(29),1,1)..command.." for help!|")
end

function OnStartup()
  Core.RegBot(Bot.name, Bot.desc, Bot.email, true)
  FetchZodiacForToday() -- Get the thing.
  zodiac_rc=""
  for k, v in ipairs(zodiac) do
    zodiac_rc=zodiac_rc.."$UserCommand 1 3 Horoscope\\"..v.."$<%[mynick]> !"..command.." "..v.."&#124;|"
  end
  zodiac_rc=zodiac_rc:sub(1,-2)
  TmrMan.AddTimer(3600*60000) -- Fire a timer, it will tick every day.
end

OnTimer = FetchZodiacForToday -- OK, another day passed by, get the stuff again.

function ChatArrival(user,data) -- Usual stuff: command processing, sending the results
  local prf="[%"..SetMan.GetString(29).."]"
  data = data:sub(1,-2)
  local cmd,sign = data:match("%b<>%s+"..prf.."(%S*)%s*(%S*)")
  if cmd == command then
    if not zodtbl[sign] then
      Core.SendPmToUser(user, Bot.name,"Usage: "..string.sub(SetMan.GetString(29),1,1)..command.." <sign>\r\nAvailable signs:\r\n"..("-"):rep(25).."\r\n"..table.concat(zodiac,"\r\n"))
    else
      local f=io.open("scripts/zodiac/"..sign..".txt","r")
      local contents = string.gsub(f:read("*a"),string.char(10), "\r\n")
      f:close()
      Core.SendPmToUser(user, Bot.name,"\r\n"..contents)
    end
    return true
  end
end

function UserConnected(user)
  Core.SendToUser(user, zodiac_rc)
end

RegConnected = UserConnected
OpConnected = UserConnected

--[[
Copyright (c) 2007, bastya_elvtars

All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:

    * Redistributions of source code must retain the above copyright notice, this
      list of conditions and the following disclaimer.
    * Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
    * Neither the name of the author nor the names of contributors may be used
      to endorse or promote products derived from this code without specific
      prior written permission.

THIS CODE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
CODE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

----------------------------------------------------------------------------------

This bot utilizes the GNU wget utiliy. That program is
licensed under the GPL. It is bundled with the script
and its source can be downloaded from:

http://www.gnu.org/software/wget/wget.html

The original binary is from:

http://users.ugent.be/~bpuype/wget/
]]
Title: Re: Horoscope script
Post by: malhi on 29 November, 2014, 03:40:32
im getting all this when i type in hub not horoscope detail


[03:38] <Zodiac> Usage: !horoscope <sign>
Available signs:
-------------------------
aquarius
aries
cancer
capricorn
gemini
leo
libra
pisces
sagittarius
scorpio
taurus
virgo


nothing els i try to type all one by one nothing same thing open again how it will show daily update ?
Title: Re: Horoscope script
Post by: the-master on 29 November, 2014, 11:08:28
Did you try !horoscope leo ?
Did you use the wget module?
Title: Re: Horoscope script
Post by: malhi on 09 December, 2014, 23:38:19
i only run horoscore file nothing els. do i need anything els 2 ?
Title: Re: Horoscope script
Post by: the-master on 10 December, 2014, 17:51:58
Yes, you need the wget part to be able to use it.
Download the zipfile from first post and use updated script, it works  :)