Giter Site home page Giter Site logo

logbot's Introduction

LogBot 0.4.2

Written by Chris Oliver [email protected]

Many thanks to Filip Slagter for his contributions.

Usage

LogBot requires Python 2. It is NOT compatible with Python 3. Configuration is done inside logbot.py.

python logbot.py

Example logs at https://raw.github.com/excid3/logbot/master/example_logs/2011-10-22.html

Channels with localised time

LogBot now also supports having localised time on a per channel basis using the pytz library, allowing you to have the logs of specific channels use different timezones. Installing pytz should be as simple as running easy_install --upgrade pytz, see http://pytz.sourceforge.net/#installation for details. Don't worry, if you don't have pytz installed, LogBot will continue to show the logs timestamped with your system's localtime as it used to.

Next you can create a simple text file at ~/.logbot-channel_locations.conf (or wherever CHANNEL_LOCATIONS_FILE in logbot.py points to). On each line you can now specify a channel name, and the timezone location of which it should use the timezone offset, separated by a space. Example:

#excid3 America/Chicago
#netherlands Europe/Amsterdam
#aloha US/Hawaii
#space UTC

Any channel not specified in this file will use the default timezone as specified in DEFAULT_TIMEZONE, which defaults to 'UTC'.

If you want to see a list of all possible timezone location names you can use, run:

python -c 'import pytz;print pytz.all_timezones'

logbot's People

Contributors

ashcrow avatar excid3 avatar fixato avatar jaraco avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

logbot's Issues

Crash upon accessing files in empty log dir

If you create an empty directory for logs by hand, and then point the bot to it, it crashes. I think it only checks if the directory exists, then tries to access non-existing files(i.e. logs/index.html).

Crash on too many IRC modes (network-specific?)

So when someone joins a channel as a registered channel founder operator on PolNet(irc.ircnet.pl) (might be network-specific), while the bot is already there, I get this:

    File "logbot.py", line 113, in on_mode
        modes, person = e.arguments()
ValueError: too many values to unpack

Full output here: http://pastebin.com/0VJJJERL.

Any way to fix it? Would be nice, since I find this bot very useful.

Error in the writing index file process

well the bot goes to add that day's log to the index file it just rewrites the whole file rather than just added that day's file. It also rewrites the main index file. for a example look at logs.geek-crack.com

Suggestion: creating main index file/checking logs on program startup

Not sure if this qualifies here, even if it does, it's a minor issue. More of a suggestion I think.

If a channel directory(logs/#channel/) does not exist, the bot creates the directory and appends a link with the name of the channel to the main index.html file("Logged Channels").
Now, if you remove only the channel directory by hand, the bot will create it, and append the link to the main index.html as usual, even though one already exists there.

Might be a good idea to check the logs on startup, maybe recreate the main index.html file based on existing logs/ subdirectories.

Username and SSL Support

I was wondering it you plan on supporting username and SSL support for the bot ? If your not going to can you update the irclib with the latest and i'll fork it and add in those.

Thanks.

issues with timeout it appears

Traceback (most recent call last):
File "logbot.py", line 351, in
main()
File "logbot.py", line 344, in main
bot.start()
File "/home/zachthibeau/logbot/ircbot.py", line 247, in start
SimpleIRCClient.start(self)
File "/home/zachthibeau/logbot/irclib.py", line 1114, in start
self.ircobj.process_forever()
File "/home/zachthibeau/logbot/irclib.py", line 229, in process_forever
self.process_once(timeout)
File "/home/zachthibeau/logbot/irclib.py", line 214, in process_once
self.process_data(i)
File "/home/zachthibeau/logbot/irclib.py", line 183, in process_data
c.process_data()
File "/home/zachthibeau/logbot/irclib.py", line 581, in process_data
self._handle_event(Event(command, prefix, target, [m]))
File "/home/zachthibeau/logbot/irclib.py", line 604, in _handle_event
self.irclibobj._handle_event(self, event)
File "/home/zachthibeau/logbot/irclib.py", line 325, in _handle_event
if handler[1](connection, event) == "NO MORE":
File "/home/zachthibeau/logbot/irclib.py", line 1049, in _dispatcher
getattr(self, m)(c, e)
File "logbot.py", line 312, in on_pubmsg
self.write_event("pubmsg", e)
File "logbot.py", line 212, in write_event
self.ftp.storbinary("STOR %s" % remote_fname, open(full_fname, "rb"))
File "/usr/lib/python2.7/ftplib.py", line 460, in storbinary
self.voidcmd('TYPE I')
File "/usr/lib/python2.7/ftplib.py", line 249, in voidcmd
return self.voidresp()
File "/usr/lib/python2.7/ftplib.py", line 224, in voidresp
resp = self.getresp()
File "/usr/lib/python2.7/ftplib.py", line 217, in getresp
raise error_temp, resp
ftplib.error_temp: 421 Timeout - try typing a little faster next time

this is from the bot I have connected to freenode, the other seperate bot is connected to another irc and hasn't timed out on the ftp uploads.

Stuck on Uploading to FTP...

Once the bot reaches the amount of messages where it's supposed to upload the logs it will get stuck on "Uploading to FTP..." until doing ctrl+c and then it will connect to the FTP and upload. I would appreciate if this could get looked into.

Bot crash with ftp timeout.

Traceback (most recent call last):
File "C:\Documents and Settings\HP_Administrator\Desktop\logbot\excid\excid3-logbot-925df20\logbot.py", line 357, in
main()
File "C:\Documents and Settings\HP_Administrator\Desktop\logbot\excid\excid3-logbot-925df20\logbot.py", line 350, in main
bot.start()
File "C:\Documents and Settings\HP_Administrator\Desktop\logbot\excid\excid3-logbot-925df20\ircbot.py", line 247, in start
SimpleIRCClient.start(self)
File "C:\Documents and Settings\HP_Administrator\Desktop\logbot\excid\excid3-logbot-925df20\irclib.py", line 1114, in start
self.ircobj.process_forever()
File "C:\Documents and Settings\HP_Administrator\Desktop\logbot\excid\excid3-logbot-925df20\irclib.py", line 229, in process_forever
self.process_once(timeout)
File "C:\Documents and Settings\HP_Administrator\Desktop\logbot\excid\excid3-logbot-925df20\irclib.py", line 214, in process_once
self.process_data(i)
File "C:\Documents and Settings\HP_Administrator\Desktop\logbot\excid\excid3-logbot-925df20\irclib.py", line 183, in process_data
c.process_data()
File "C:\Documents and Settings\HP_Administrator\Desktop\logbot\excid\excid3-logbot-925df20\irclib.py", line 581, in process_data
self._handle_event(Event(command, prefix, target, [m]))
File "C:\Documents and Settings\HP_Administrator\Desktop\logbot\excid\excid3-logbot-925df20\irclib.py", line 604, in _handle_event
self.irclibobj._handle_event(self, event)
File "C:\Documents and Settings\HP_Administrator\Desktop\logbot\excid\excid3-logbot-925df20\irclib.py", line 325, in _handle_event
if handler[1](connection, event) == "NO MORE":
File "C:\Documents and Settings\HP_Administrator\Desktop\logbot\excid\excid3-logbot-925df20\irclib.py", line 1049, in _dispatcher
getattr(self, m)(c, e)
File "C:\Documents and Settings\HP_Administrator\Desktop\logbot\excid\excid3-logbot-925df20\logbot.py", line 315, in on_pubmsg
self.write_event("pubmsg", e)
File "C:\Documents and Settings\HP_Administrator\Desktop\logbot\excid\excid3-logbot-925df20\logbot.py", line 212, in write_event
self.ftp.storbinary("STOR %s" % remote_fname, open(full_fname, "rb"))
File "C:\Python27\lib\ftplib.py", line 453, in storbinary
self.voidcmd('TYPE I')
File "C:\Python27\lib\ftplib.py", line 249, in voidcmd
return self.voidresp()
File "C:\Python27\lib\ftplib.py", line 224, in voidresp
resp = self.getresp()
File "C:\Python27\lib\ftplib.py", line 210, in getresp
resp = self.getmultiline()
File "C:\Python27\lib\ftplib.py", line 196, in getmultiline
line = self.getline()
File "C:\Python27\lib\ftplib.py", line 183, in getline
line = self.file.readline()
File "C:\Python27\lib\socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 10054] An existing connection was forcibly closed by the remote host

Please add support for making the nickname and username of the bot different from each other.

I am attempting to use the bot with the rather unusually configured server irc.mindfang.org:6667
The server has a rule where all clients must use the string "pcc31" as their USER name.
Example server message showing this: :[email protected] PRIVMSG #The_Former_SBARG_Players :<c=254,124,39>PK: Who are you</c>

As I am unable to change my nickname and USER name separately, the bot is forced to use the non-descriptive nickname of "pcc31" to be able to connect. Please make it possible to change the bot's USER name.

Channel key support

I'd like to use logbot for an internal IRC server at work but the channels we have setup require a key, is there quick modification that can be made so logbot can support this?

Thanks,
Tim

Suggestions: New/update features

Ok, as you asked for on freenode:

Repair the ability to log /parts
Add ability to log nickchanges
Show nick!user@host in /joins and /parts
Someone in channel says @help, bot gives them link defined in file. I.E. I say @help. Botlogger says: Hi! I'm a log bot made by excid3. The logs for this bot can be found at: (uri defined in file)
make @help customizable, I.e, can be set to #help or !help

And, as previously mentioned by someone, creates html indexes of the folders. I.e. in the folder logs, it creates index.html, which has links to the folders within logs. AND within folder #chan, it creates index.html which links to all the files in there. Files should be listed in anti-chronological order, meaning today is always at the top, and the bots first day of use is at the bottom

Stuff to add! :D

Can you add topic changes, mode changes, parts, and quits? :P
and nick changes
What else happens in a channel?
/notice
and
(And add in the nickserv stuff so i don't have to rehard code it in :P)
(And oper would be cool too, but 99% of people wouldn't use that xP)

Crash on FTP Timeout

When the FTP server closes the connection due to idleness the bot crashes and stops logging. See the following traceback.

Uploading to FTP...
Traceback (most recent call last):
File "logbot.py", line 350, in
main()
File "logbot.py", line 343, in main
bot.start()
File "/home/daniel/src/logbot/ircbot.py", line 247, in start
SimpleIRCClient.start(self)
File "/home/daniel/src/logbot/irclib.py", line 1114, in start
self.ircobj.process_forever()
File "/home/daniel/src/logbot/irclib.py", line 229, in process_forever
self.process_once(timeout)
File "/home/daniel/src/logbot/irclib.py", line 214, in process_once
self.process_data(i)
File "/home/daniel/src/logbot/irclib.py", line 183, in process_data
c.process_data()
File "/home/daniel/src/logbot/irclib.py", line 600, in process_data
self._handle_event(Event(command, prefix, target, arguments))
File "/home/daniel/src/logbot/irclib.py", line 604, in _handle_event
self.irclibobj._handle_event(self, event)
File "/home/daniel/src/logbot/irclib.py", line 325, in _handle_event
if handler[1](connection, event) == "NO MORE":
File "/home/daniel/src/logbot/irclib.py", line 1049, in _dispatcher
getattr(self, m)(c, e)
File "logbot.py", line 282, in on_join
self.write_event("join", e)
File "logbot.py", line 211, in write_event
self.ftp.storbinary("STOR %s" % remote_fname, open(full_fname, "rb"))
File "/usr/lib64/python2.7/ftplib.py", line 453, in storbinary
self.voidcmd('TYPE I')
File "/usr/lib64/python2.7/ftplib.py", line 249, in voidcmd
return self.voidresp()
File "/usr/lib64/python2.7/ftplib.py", line 224, in voidresp
resp = self.getresp()
File "/usr/lib64/python2.7/ftplib.py", line 217, in getresp
raise error_temp, resp
ftplib.error_temp: 421 No transfer timeout (600 seconds): closing control connection

Suggestion: store settings in an external config file.

Currently you have to edit the logbot.py file to change settings. As a result, you can't easily run multiple instances of the same script.
It would be nice if the script only used the current constants as defaults, and allowed for a config file to be passed as a commandline argument that would override the defaults.

I wouldn't mind implementing this myself, but as I'm new to Python and don't really know what the config file standard is (YAML, JSON, ini, etc?), maybe we could discuss it in this ticket. :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.