bytespeicher / bytebot Goto Github PK
View Code? Open in Web Editor NEWIRC bot for the #Bytespeicher channel
License: MIT License
IRC bot for the #Bytespeicher channel
License: MIT License
The URL shorturl
plugin should be configurable to use other shortener functions.
The following changes need to be made:
If the title of the HTML page is too long, the bot sends multiple messages in rapid succession. This could lead to a kick for excessive flooding.
Title-length should be limited to a sensible length, like 60-70 characters.
When the status of all parking places returns an error, the plugin should not return all places with an error, but rather display one simple error message.
Plugins should be able to store data permanently and semi-permanently through an abstraction layer.
Please add the number of unknown users to !users
When trying to get dates with the following configuration:
'dates': {
'url': 'http://www.google.com/calendar/ical/2eskb61g20prl65k2qd01uktis%40group.calendar.google.com/public/basic.ics',
},
It throws an exception for the date/timezone implementation:
Unhandled Error
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 525, in __bootstrap
self.__bootstrap_inner()
File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 505, in run
self.__target(_self.__args, *_self.__kwargs)
--- ---
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-> x86_64.egg/twisted/python/threadpool.py", line 191, in _worker
result = context.call(ctx, function, _args, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux- x86_64.egg/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, _args, *_kw)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/python/context.py", line 81, in callWithContext
return func(args,*kw)
File "/home/bytespeicher/Bytebot/plugins/dates.py", line 66, in onPrivmsg
dt_local = dt_utc.astimezone(timezoneEF)
exceptions.AttributeError: 'datetime.date' object has no attribute 'astimezone'
Some plugin spits this error on every request/message and on every cron run.
Config: BYTEBOT_SSL = False
Error-Message:
Traceback (most recent call last):
File "./bytebot.py", line 192, in
reactor.connectSSL(BYTEBOT_SERVER, int(BYTEBOT_PORT), f)
TypeError: connectSSL() takes at least 5 arguments (4 given)
The bot should inform about new issues or releases. This is possible via with the Webhooks API Github provides.
The Bytebot should be started and daemonized via system daemon scripts. That should at least be SysV init shell script and - for future safety - a systemd unit file.
The bot may be started with a different config file. The call should look like the following:
./bytebot.py [-f config-file]
DEBUG: _parse_msg
ERROR :Closing Link: 134.97.126.52 (Connection timed out)
The default time zone of the dates plugin is UTC. The desired time zone should be defined, e.g. CET. The script must convert UTC to the defined TZ. #19
In a future Bytestatus system a key owner data base may be implemented. The bot can check the data base with the !key trigger and tell the channel who owns the Bytespeicher keys at the moment.
The plugin should report, if nothing was returned by the API.
plugin "dates" report the following:
2015-11-16 15:34:51+0100 [-] Unhandled Error
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/_threads/_threadworker.py", line 46, in work
task()
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/_threads/_team.py", line 190, in doWork
task()
--- <exception caught here> ---
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/python/threadpool.py", line 241, in inContext
result = inContext.theWork()
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/python/threadpool.py", line 257, in <lambda>
inContext.theWork = lambda: context.call(ctx, func, *args, **kw)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/python/context.py", line 81, in callWithContext
return func(*args,**kw)
File "/home/bytebot/Bytebot/plugins/dates.py", line 126, in onPrivmsg
for e in rset.between(now, then):
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/dateutil/rrule.py", line 234, in between
for i in gen:
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/dateutil/rrule.py", line 1144, in _iter
self._genitem(rlist, gen)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/dateutil/rrule.py", line 1082, in __init__
self.dt = advance_iterator(gen)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/dateutil/rrule.py", line 652, in _iter
if until and res > until:
exceptions.TypeError: can't compare offset-naive and offset-aware datetimes
The iCal parser plugin dates.py reads the dates from a Google iCal but prints out the dates in chronological wrong order.
There should be a plugin that allows to set a secondary space status to "be right back".
Those updates SHOULD then be distributed to the space status JSON. That way the status page, the Twitter status bot and the IRC topic plugin can react to this change and set their messages appropriately.
I propose to set the command to "!brb". This MUST NOT be set by anyone outside the space.
As the knowledge of which user is inside the space is a prerequisite issue #11 MUST be implemented first.
Before any implementation can take place there MUST be a way to set and retrieve a secondary status from the status JSON as well.
Enable automatic reload of the Bytebot components when code changes occur.
Reload should be an option and disabled by default.
A Godwin-Counter should be implemented. Functionalities should include counting the occurences of "Hitler" and synonyms.
A per-channel or per-user statistic is open for discussion.
The counter should be stored in permanent or semi-permanent location.
The following line in dates.py should use a plugin option from the Bytebot config:
nweek = now + timedelta(weeks=1)
The cron is not starting properly anymore.
Add a plugin that reads an RSS stream and posts new items to the IRC channel
See list of style issues on codacy
If a user corrects a message with 's/text/newtext/' this regex should be applied to the last message from this user.
The Bytebot config should enable one to change the logging output to a syslog server instead of stdout.
Also a debug level needs to be implemented.
All code should be written in our new coding guidelines. See CONTRIBUTING.
The bot should print the next dates for Bytespeicher events from a specific iCal URL with the !dates trigger. It must contain the date, the time, the event name and the event description.
Show the connected devices or users in space when a trigger is set, e.g. !users
Recurring dates are missing from the date plugin output.
Without an API key the goo.gl shortener will return the following error message when trying to shorten any URL:
{
"error": {
"errors": [
{
"domain": "usageLimits",
"reason": "dailyLimitExceededUnreg",
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup.",
"extendedHelp": "https://code.google.com/apis/console"
}
],
"code": 403,
"message": "Daily Limit for Unauthenticated Use Exceeded. Continued use requires signup."
}
}
The configuration needs an additional option for the API key and the key should be used when sending requests to Google. More information on how to retrieve the key and use it: https://developers.google.com/url-shortener/v1/getting_started
The plugin will sends the open/closed change message always twice.
It should be possible to set the maximum time for the plugin output, e.g. 30m
A Gateway to the Google Hangouts groupchat should be implemented
Hey... bringt dem Bytebot mal Umlaute bei... geht ja gar nicht!!!!1111einseinszwei
14:19 < XXXXXX> XXXXXXXXX http://de.wikipedia.org/wiki/B%C3%BCsingen_am_Hochrhein#Weitere_Besonderheiten
14:19 @bytebot Bsingen am Hochrhein Wikipedia
14:19 @bytebot URL: http://goo.gl/czEa1
Reinhaun!
When a server is unreacheable or returns an empty result or error page, the RSS plugin should ignore that feed and try to fetch it later.
Currently, it fetches the feed and saves the empty result. This will lead to a long list of changes send to the channel when the feed is available again.
If the bot is started the first time with e.g. the RSS reader plugin configured, it will be kicked for excess flooding as it tries to send all messages at once without any rate-limit. Messages from the bot should always be rate-limited. If a plugin tries to send too many messages at once this should trigger a warning and drop any messages above a certain message count.
The bot should have an install and/or update script to help set up the bot. Ideally this would be an ncurses menu or something similar.
This script should help with the configuration of standard variables and plugins.
This also means, we need an easy way to define configuration variables for the bot and all plugins.
The !users API is missing the else-case for when 0 users are present. See spacestatus.py line 42
Topic gets reset every minute despite not having changed
When a user sends a URL of a big file the plugin will try to download the whole file. This is not necessary as plain files don't have HTML Header tags to check for.
To mitigate this problem there SHOULD be a configurable size limit and a whitelist of content types that will be parsed for title tags.
The autoop plugin should use hostmasks or allow usernames for specific(registered) users and hostmasks for other ops instead of only usernames.
Bot leaves IRC Channel after the following Errors:
2015-11-17 18:32:21+0100 [-] Unhandled error in Deferred:
2015-11-17 18:32:21+0100 [-] Unhandled Error
Traceback (most recent call last):
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1194, in run
self.mainLoop()
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1203, in mainLoop
self.runUntilCurrent()
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/base.py", line 825, in runUntilCurrent
call.func(*call.args, **call.kw)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/task.py", line 213, in __call__
d = defer.maybeDeferred(self.f, *self.a, **self.kw)
--- <exception caught here> ---
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/defer.py", line 150, in maybeDeferred
result = f(*args, **kw)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/words/protocols/irc.py", line 1148, in _sendHeartbeat
self.sendLine('PING ' + self.hostname)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/words/protocols/irc.py", line 1117, in sendLine
self._reallySendLine(line)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/words/protocols/irc.py", line 1113, in _reallySendLine
return basic.LineReceiver.sendLine(self, lowQuote(line) + '\r')
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/protocols/basic.py", line 635, in sendLine
return self.transport.write(line + self.delimiter)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/protocols/tls.py", line 530, in write
self._write(bytes)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/protocols/tls.py", line 573, in _write
self._flushSendBIO()
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/protocols/tls.py", line 343, in _flushSendBIO
self.transport.write(bytes)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/_newtls.py", line 191, in write
FileDescriptor.write(self, bytes)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/abstract.py", line 355, in write
self.startWriting()
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/abstract.py", line 442, in startWriting
self.reactor.addWriter(self)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/epollreactor.py", line 288, in addWriter
EPOLLOUT, EPOLLIN)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/epollreactor.py", line 255, in _add
self._poller.modify(fd, flags)
exceptions.IOError: [Errno 2] No such file or directory
2015-11-17 18:32:21+0100 [ByteBot (TLSMemoryBIOProtocol),client] Unhandled Error
Traceback (most recent call last):
File "/home/bytebot/Bytebot/bytebot.py", line 196, in <module>
reactor.run()
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1194, in run
self.mainLoop()
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/base.py", line 1206, in mainLoop
self.doIteration(t)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/epollreactor.py", line 396, in doPoll
log.callWithLogger(selectable, _drdw, selectable, fd, event)
--- <exception caught here> ---
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/python/log.py", line 101, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/python/log.py", line 84, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/python/context.py", line 81, in callWithContext
return func(*args,**kw)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/posixbase.py", line 610, in _doReadOrWrite
self._disconnectSelectable(selectable, why, inRead)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/posixbase.py", line 255, in _disconnectSelectable
selectable.connectionLost(f)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/tcp.py", line 479, in connectionLost
self._commonConnection.connectionLost(self, reason)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/tcp.py", line 293, in connectionLost
protocol.connectionLost(reason)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/protocols/tls.py", line 477, in connectionLost
ProtocolWrapper.connectionLost(self, reason)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/protocols/policies.py", line 125, in connectionLost
self.wrappedProtocol.connectionLost(reason)
File "/home/bytebot/Bytebot/bytebot.py", line 37, in connectionLost
irc.IRCClient.connectionLost(self, reason)
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/words/protocols/irc.py", line 1134, in connectionLost
self.stopHeartbeat()
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/words/protocols/irc.py", line 1159, in stopHeartbeat
self._heartbeat.stop()
File "/home/bytebot/Bytebot/env/local/lib/python2.7/site-packages/twisted/internet/task.py", line 176, in stop
assert self.running, ("Tried to stop a LoopingCall that was "
exceptions.AssertionError: Tried to stop a LoopingCall that was not running.
Output using encode('ascii') should replace this with encode('utf-8'), so unicode characters are displayed properly.
If a user posts a message with a link a shortened link along with the content of the HTML title tag of that page(if available) should be posted.
The current Bytebot code base is a mess when looking at consistency of code style. This is a problem, when new developers want to contribute or developers are looking for bugs in code they did not write.
To fight this, a code style guide should be created, that looks at the current code base and general Python code style best practices like PEP 8. This especially means checking line length, function and variable naming, a proper doc-block style, ...
Looking at PEP 8 and Twisted's naming conventions, these are clearly not compatible - Twisted uses camel-case-style naming, while PEP 8 will tell you to use names with underscores for better readability. So we could either abide to Twisted's camel case or mix camel case and underscore naming.
Breaking style compatibility with twisted has advantages and disadvantages. Mainly, PEP 8 itself states, that consistency is key to readability, so mixing style could have an impact on readability. But mixing the Twisted function naming with PEP 8 naming would make distinguishing Twisted and Bytebot functions easier.
So my proposal would be:
For the general code base, a clear style(with consideration for PEP-8 should be adopted:
from mod import *
)self
as the first keywordcls
as the first keywordThe automatic topic modification repeats the topic change after one minute when a room status was switched. It's most likely related to a cron issue.
Catch twisted.internet.error.TimeoutError and restart connection instead of letting the bot commit suicide.
Traceback (most recent call last):
File "/home/bytespeicher/Bytebot/bytebot.py", line 197, in <module>
reactor.run()
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/base.py", line 1192, in run
self.mainLoop()
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/base.py", line 1204, in mainLoop
self.doIteration(t)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/epollreactor.py", line 396, in doPoll
log.callWithLogger(selectable, _drdw, selectable, fd, event)
--- <exception caught here> ---
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/python/log.py", line 88, in callWithLogger
return callWithContext({"system": lp}, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/python/log.py", line 73, in callWithContext
return context.call({ILogContext: newCtx}, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/python/context.py", line 118, in callWithContext
return self.currentContext().callWithContext(ctx, func, *args, **kw)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/python/context.py", line 81, in callWithContext
return func(*args,**kw)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/posixbase.py", line 627, in _doReadOrWrite
self._disconnectSelectable(selectable, why, inRead)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/posixbase.py", line 263, in _disconnectSelectable
selectable.connectionLost(failure.Failure(why))
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/tcp.py", line 483, in connectionLost
self.failIfNotConnected(error.ConnectError(string=reason))
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/tcp.py", line 460, in failIfNotConnected
self.connector.connectionFailed(failure.Failure(err))
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/internet/base.py", line 1077, in connectionFailed
self.factory.clientConnectionFailed(self, reason)
File "/usr/local/lib/python2.7/dist-packages/Twisted-13.2.0-py2.7-linux-x86_64.egg/twisted/protocols/policies.py", line 163, in clientConnectionFailed
self.wrappedFactory.clientConnectionFailed(connector, reason)
File "/home/bytespeicher/Bytebot/bytebot.py", line 171, in clientConnectionFailed
log("FATAL: connection failed: %s" % reason, level=LOG_ERROR)
exceptions.TypeError: 'module' object is not callable
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.