RSS fetcher for BOTZ
BOTZ is a pure python3 framework to program bots (a botlib), provides IRC and XMPP bots and is extendible by programming your own commands. Basic functionality is a RSS feed fetcher you can use to display feeds into your channel. BOTZ uses a timestamped, type in filename, JSON stringified, files on filesystem backend and has timed based logging capabilities. BOTZ has been placed in the Public Domain and contains no copyright or LICENSE.
S O U R C E
botz.base - base classes. botz.bot - event handler. botz.clock - timers, repeaters. botz.cmds - basic command set. botz.edit - json file editor. botz.email - email scanning module. botz.entry - simple data entry commands. botz.event - event handler. botz.fleet - list of bots. botz.handler - event handler. botz.kernel - main select loop. botz.loader - module loader. botz.poller - polling based handler. botz.rss - feed fetcher. botz.shell - shell related commands. botz.store - timestamped json file backend. botz.tasks - botz threads. botz.udp - udp to channel relay. botz.users - manage users. botz.utils - utility functions. botz.xmpp - xmpp bot.
P R O G R A M M I N G
programming your own commands is easy, your can load modules with the -m option. if you create a mods directory and put your hello.py module in it, you would use:
> botz -m mods
any command you have coded in hello.py would be available, see the show cmds command.
> botz show cmds
a command is a function with one argument, the event that was generated on the bot.
- def mycmd(event):
- <your code here>
you can use event.reply() to send response back to the user:
- def hello(event):
- event.reply(“hello %s” % event.nick)
after starting botz with -m mods, you see the hello command added to the bot:
> s cmds
I N S T A L L
you can fetch BOTZ from the following:
if you need botz to have access to your local directory use this:
> export PYTHONPATH=”.”
this will add your current directory to the pythonpath so the packages in it can be found by botz.
installation is through pypi:
> sudo pip3 install botz
you can also run the bot from the tarball at pypi and run it directly or install with setup.py:
> python3 setup.py install –user
C O N F I G U R A T I O N
botz includes one program, the botz shell:
> botz [-m mod1,mod2] command
to connect to irc use the -m irc option.
> botz -m irc -s irc.freenode.net -c #dunkbots -n botzi -z
to use the xmpp module is almost the same.
> botz -m xmpp -s email@example.com -p <password> -z
to use the bot as a rss feed reader, add a feed url with the rss command:
> botz rss https://www.reddit.com/r/Python/new/.rss
and start the bot with the rss module loaded
> botz -m rss -z
this will start a fetcher that will display the feed you have entered on your channel.
H A V E F U N