myDC.ru

Здравствуйте, гость ( Вход | Регистрация )

 
История благодарностей участнику TIRAN. Спасибо сказали: 2
Дата поста: В теме: За сообщение: Спасибо сказали:
2.4.2010, 5:55 RSS лента
Незнаю в чём проблема....


В общем решил переделать RSS под себя.

Было так:

Раскрывающийся текст
-- "Botname" ["" = hub bot]
local Bot = "ServiceBot"
-- Save recent feeds to this file for script/hub restarts
local File = "FeedWatch.dat"
-- Set your feed's URL
local Feed = "http://bash.org.ru/rss/"
-- Set the update interval [in minutes]
local Refresh = 60
-- Enable capture of these RSS fields
local Fields = {
["<title>"] = true,
["<description>"] = true,
["<link>"] = true,
["<author>"] = false,
["<category>"] = false,
["<comments>"] = false,
["<pubDate>"] = true,
["<guid>"] = false,
}

--Replace these strings in feed XML [--Comment unwanted replacements]
local Rep = {
["%<%!%[CDATA%["] = "",
["%]%]%>"] = "",
["%[code *%]"] = "",
["<img [^>]*>"] = "",
["<p>"] = "",
["<a href[^\w]+"] = "",
["<br />"] = " ",
["\t"] = " ",
["\r\n"] = "",
["["] = string.char(91),
["]"] = string.char(93),
[" [ ]+"] = " ",
["<div class=\"codeheader\">"] = "",
}
-- Truncate RSS fields to this width.
local MaxWidth = 8500
-- Remove all HTML <tags> in feed fields? true/false
local TagFilter = true
-- Always send new feed to pm? true/false
local OnlyPm = true
-- Append new feeds to MOTD? [Motd restored at script exit]
local DoMotd = false
-- "Preset FeedNick" [Nick new feeds are sent from] / false = Use feed title for FeedNick
local FeedNick = false

tProfile = {
[-1] = 0,
[0] = 1,
[1] = 1,
[2] = 1,
[3] = 1,
[4] = 1,
}
--//--


local socket = require"socket"
assert(socket,"Failed to load socket extension. Check files.")
local http = require("socket.http")
assert(http,"Failed to load http module. Check files.")
local Asc = {},0,""

OnStartup = function()
if Bot == "" then Bot = SetMan.GetString(21) end
if loadfile(File) then dofile(File) else Old = {} SaveFile(File,Old,"Old") end
end

function UserConnected(tUser)
if tProfile[tUser.iProfile] == 1 then
Core.SendToUser(tUser,"$UserCommand 1 3 Онлайн сервисы\\RSS Новости\\Bash.Org.ru$<%[mynick]> !rssfactorial|")
end
end
OpConnected = UserConnected
RegConnected = UserConnected


Стало так:

Раскрывающийся текст
-- "Botname" ["" = hub bot]
local Bot = "ServiceBot"
-- Save recent feeds to this file for script/hub restarts
local File = "FeedWatch2.dat"
-- Set your feed's URL
local Feed = "http://lenta.ru/rss/"
-- Set the update interval [in minutes]
local Refresh = 60
-- Enable capture of these RSS fields
local Fields = {
["<title>"] = true,
["<description>"] = true,
["<link>"] = true,
["<author>"] = false,
["<category>"] = false,
["<comments>"] = false,
["<pubDate>"] = true,
["<guid>"] = false,
}

--Replace these strings in feed XML [--Comment unwanted replacements]
local Rep = {
["%<%!%[CDATA%["] = "",
["%]%]%>"] = "",
["%[code *%]"] = "",
["<img [^>]*>"] = "",
["<p>"] = "",
["<a href[^\w]+"] = "",
["<br />"] = " ",
["\t"] = " ",
["\r\n"] = "",
["["] = string.char(91),
["]"] = string.char(93),
[" [ ]+"] = " ",
["<div class=\"codeheader\">"] = "",
}
-- Truncate RSS fields to this width.
local MaxWidth = 8500
-- Remove all HTML <tags> in feed fields? true/false
local TagFilter = true
-- Always send new feed to pm? true/false
local OnlyPm = true
-- Append new feeds to MOTD? [Motd restored at script exit]
local DoMotd = false
-- "Preset FeedNick" [Nick new feeds are sent from] / false = Use feed title for FeedNick
local FeedNick = false

tProfile = {
[-1] = 0,
[0] = 1,
[1] = 1,
[2] = 1,
[3] = 1,
[4] = 1,
}
--//--


local socket = require"socket"
assert(socket,"Failed to load socket extension. Check files.")
local http = require("socket.http")
assert(http,"Failed to load http module. Check files.")
local Asc = {},0,""

OnStartup = function()
if Bot == "" then Bot = SetMan.GetString(21) end
if loadfile(File) then dofile(File) else Old = {} SaveFile(File,Old,"Old") end
end

function UserConnected(tUser)
if tProfile[tUser.iProfile] == 1 then
Core.SendToUser(tUser,"$UserCommand 1 3 Онлайн сервисы\\RSS Новости\\Lenta.ru$<%[mynick]> !rssfactorial|")
end
end
OpConnected = UserConnected
RegConnected = UserConnected


Я догадываюсь что дело в этой строке
Core.SendToUser(tUser,"$UserCommand 1 3 Онлайн сервисы\\RSS Новости\\Lenta.ru$<%[mynick]> !rssfactorial|")

Но я незнаю где взять другую и что менять...
=============================
Всё, разобрался exciting.gif

Не думал что всё так просто... оказывается вызов к !rssfactorial идёт 2 раза... 2ой не заметил сначала. Поэтому и кидал с БАШа. добавил 2 в конце в обоих местах - заработало =)
Invisible, Shark48

RSS Сейчас: 4.12.2022, 18:40