zachkont / dotaupdatesbot Goto Github PK
View Code? Open in Web Editor NEWA telegram bot for dota2 updates
License: GNU General Public License v3.0
A telegram bot for dota2 updates
License: GNU General Public License v3.0
This would be a good option for your database needs. You wouldn't have to move the entire bot onto AWS.
Error Log
Traceback (most recent call last):
File "./main.py", line 191, in <module>
bot.polling(none_stop=True, interval=0)
File "/home/user/.local/lib/python2.7/site-packages/telebot/__init__.py", line 174, in polling
self.__threaded_polling(none_stop, interval, timeout)
File "/home/user/.local/lib/python2.7/site-packages/telebot/__init__.py", line 197, in __threaded_polling
polling_thread.raise_exceptions()
File "/home/user/.local/lib/python2.7/site-packages/telebot/util.py", line 72, in raise_exceptions
six.reraise(self.exc_info[0], self.exc_info[1], self.exc_info[2])
File "/home/user/.local/lib/python2.7/site-packages/telebot/util.py", line 53, in run
task(*args, **kwargs)
File "/home/user/.local/lib/python2.7/site-packages/telebot/__init__.py", line 120, in __retrieve_updates
updates = self.get_updates(offset=(self.last_update_id + 1), timeout=timeout)
File "/home/user/.local/lib/python2.7/site-packages/telebot/__init__.py", line 90, in get_updates
json_updates = apihelper.get_updates(self.token, offset, limit, timeout)
File "/home/user/.local/lib/python2.7/site-packages/telebot/apihelper.py", line 131, in get_updates
return _make_request(token, method_url, params=payload)
File "/home/user/.local/lib/python2.7/site-packages/telebot/apihelper.py", line 26, in _make_request
result = requests.request(method, request_url, params=params, files=files)
File "/home/user/.local/lib/python2.7/site-packages/requests/api.py", line 58, in request
return session.request(method=method, url=url, **kwargs)
File "/home/user/.local/lib/python2.7/site-packages/requests/sessions.py", line 508, in request
resp = self.send(prep, **send_kwargs)
File "/home/user/.local/lib/python2.7/site-packages/requests/sessions.py", line 618, in send
r = adapter.send(request, **kwargs)
File "/home/user/.local/lib/python2.7/site-packages/requests/adapters.py", line 490, in send
raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine("''",))
Exception in thread WorkerThread2 (most likely raised during interpreter shutdown):Exception in thread WorkerThread1:
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
File "/home/user/.local/lib/python2.7/site-packages/telebot/util.py", line 56, in run
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'Empty'
Add a command like /info
, that provides information about this project and points the user to this GitHub page.
Inspired by the poll, it would be cool to have an option to only be notified when the patch analysis is complete.
First, a simple delay should suffice, later we can expand by analyising the threads, looking for the Analysis Status: Done
keyword.
Of course, for blog posts / updates without the Analysis Status
segment the bot would notify the user immediately.
/match
, without any match ID, the bot doesn't respond at all./match ID
, orScreenshot of the current output:
The updater.py script ends up using way too much memory after running for days.
Investigation is required to pinpoint the cause (current suspect is the log file).
Right now every call to the telegram API is within try-except blocks that just catch everything. Further investigation is required to either remove or refine those checks
The bot.polling()
function sometimes fails. Further investigation is required, perhaps it is a bug in the original repo too
We can use this feed http://www.dota2.com/news/updates/ to include patch notes posted there
Add a command (/dotaupdate
or similar) that displays the latest patch analysis from /u/SirBelvedere or /u/Magesunite
utils.py
is currently a port from a different repo and therefore contains unused code. It would be best if it is stripped down of anything not useful for this application.
Logging is kind of messy right now, using the logger module is a more appropriate approach.
Any new modules should also be included in the dockerfile dependencies.
JSON files are easy to use but far from ideal. Migrating to MongoDB is the obvious choice, but I would prefer something more... editable, for testing purposes and future usage of the saved links in other projects. Or at least some accompanying scripts for basic CRUD and display on the DB.
Suggestions are welcome
Add a new command to request (5?) recent pro matches from the OpenDota API
It would be good to also add an argument in the command to filter a specific tournament or team
When a user has blocked the bot or a group has removed it without unsubscribing, the telegram API returns:
2017-11-08 14:52:30,194 (updater.py:82 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 403 Forbidden. Response body: [{"ok":false,"error_code":403,"description":"Forbidden: bot was blocked by the user"}]"
and:
2017-11-08 14:52:31,062 (updater.py:90 MainThread) ERROR - TeleBot: "A request to the Telegram API was unsuccessful. The server returned HTTP 403 Forbidden. Response body: [{"ok":false,"error_code":403,"description":"Forbidden: bot was kicked from the group chat"}]"
respectively.
It would be best if in such cases the corresponding users/groups where removed from the subscribers list
Traceback (most recent call last):
File "./updater.py", line 148, in <module>
check_for_updates_and_notify()
File "./updater.py", line 143, in check_for_updates_and_notify
posts = get_dota2blog_posts()
File "./updater.py", line 34, in get_dota2blog_posts
return get_rss_posts("http://blog.dota2.com/feed/", "Dota 2 blog feed not accessible.")
File "./updater.py", line 24, in get_rss_posts
if feed and feed.status:
File "/home/user/.local/lib/python2.7/site-packages/feedparser.py", line 400, in __getattr__
raise AttributeError, "object has no attribute '%s'" % key
AttributeError: object has no attribute 'status'
Exception in thread WorkerThread1 (most likely raised during interpreter shutdown):
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 801, in __bootstrap_inner
File "/home/user/.local/lib/python2.7/site-packages/telebot/util.py", line 56, in run
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute 'Empty'
The entire preview text is surrounded by
[u' _TEXT_ ' , u'; <_HTML_LINK_ >']...
so probably a text to Unicode parsing error in python?
Just a small QoL improvement:
Only display [...]
when the text preview actually can't display all changes.
Steam News
Screenshot:
The utils.py module should probably create the grouplist.json
, userlist.json
, previousblogposts.json
, previousmagesunite.json
, previouscyborgmatt.json
, previousbelvedere.json
and previouswykrhm .json
and initialize them as json files.
This is a temporary enhancement until #15 is addressed
The README file is underwhelming at the moment. There is room for a lot of improvement, from improving the installation guide to improving the general layout. If anyone has any suggestions, I'm all ears.
As of now, the text is formatted as code. Probably a normal text formatting would be better suited for the news.
Either way, these things should get fixed:
Link to the current Steam News
Screenshot of the current output:
This is another good option for the database. You can use infrastructure as code to set it up.
Currently, some posts (e.g. from Wyk) are not restricted to Dota and also show Artifact announcements.
Those should probably be filtered out eventually, especially when we have a seperate bot for Artifact.
This is mostly addressed to people new in python and/or github
Every good project should include some unit testing. Here are some useful links about it:
Please submit your tests at the tests
branch, and keep it at 1 commit per test.
Comments will be appreciated.
It would be cool to have one, with fun graphics etc. Not sure what would be on it but sky's the limit I guess
Currently, everything gets previewed twice, first as code text preview and then as link preview.
The link one looks a bit better in my opinion, but doesn't remove the formatting strings, the code text preview contains unimportant information from reddit, such as
submitted by /u/SirBelvedere to r/DotA2 [link] [comments]
.
So one of them should be removed and improved accordingly.
The README.md suggests that there is a /help
command, but it doesn't get suggested when typing /
and when writing /help
it only displays the welcoming message.
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.