evennia.server.portal.rss

RSS parser for Evennia

This connects an RSS feed to an in-game Evennia channel, sending messages to the channel whenever the feed updates.

class evennia.server.portal.rss.RSSReader(factory, url, rate)[源代码]

基类:evennia.server.session.Session

A simple RSS reader using the feedparser module.

__init__(factory, url, rate)[源代码]

Initialize the reader.

参数
  • factory (RSSFactory) – The protocol factory.

  • url (str) – The RSS url.

  • rate (int) – The seconds between RSS lookups.

get_new()[源代码]

Returns list of new items.

disconnect(reason=None)[源代码]

Disconnect from feed.

参数

reason (str, optional) – Motivation for the disconnect.

data_in(text=None, **kwargs)[源代码]

Data RSS -> Evennia.

关键字参数
  • text (str) – Incoming text

  • kwargs (any) – Options from protocol.

update(init=False)[源代码]

Request the latest version of feed.

参数

init (bool, optional) – If this is an initialization call or not (during init, all entries are conidered new).

提示

This call is done in a separate thread to avoid blocking on slow connections.

class evennia.server.portal.rss.RSSBotFactory(sessionhandler, uid=None, url=None, rate=None)[源代码]

基类:object

Initializes new bots.

__init__(sessionhandler, uid=None, url=None, rate=None)[源代码]

Initialize the bot.

参数
  • sessionhandler (PortalSessionHandler) – The main sessionhandler object.

  • uid (int) – User id for the bot.

  • url (str) – The RSS URL.

  • rate (int) – How often for the RSS to request the latest RSS entries.

start()[源代码]

Called by portalsessionhandler. Starts the bot.