steffo99 / greed Goto Github PK
View Code? Open in Web Editor NEWCustomizable, multilanguage Telegram shop bot with Payments support
License: GNU Affero General Public License v3.0
Customizable, multilanguage Telegram shop bot with Payments support
License: GNU Affero General Public License v3.0
Un'altra domanda, la valuta dei Prezzi rimane costantemente in euro, anche se il file config. ini è stato modificato come hai detto? Grazie
@FuckPtero reported on Telegram that bot.getUpdates()
returned None
instead of an empty list.
I could not reproduce.
Is it a setup error? 🤔
The cancel button does not return the user to the previous menu when clicking on Cancel from the Help / Support section:
https://github.com/Steffo99/greed/blob/master/worker.py#L1159
Hello! The maximum number is 3 digits, but I would like to have no restrictions. Thank!
https://sentry.io/stefano-pigozzi/greed/issues/559774026/
InterfaceError: Error binding parameter 0 - probably unsupported type.
File "sqlalchemy/engine/base.py", line 1193, in _execute_context
context)
File "sqlalchemy/engine/default.py", line 507, in do_execute
cursor.execute(statement, parameters)
InterfaceError: (sqlite3.InterfaceError) Error binding parameter 0 - probably unsupported type. [SQL: 'UPDATE products SET price=? WHERE products.id = ?'] [parameters: (<Price of value 360>, 1)] (Background on this error at: http://sqlalche.me/e/rvf5)
(20 additional frame(s) were not displayed)
...
File "sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception
exc_info
File "sqlalchemy/util/compat.py", line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "sqlalchemy/util/compat.py", line 186, in reraise
raise value.with_traceback(tb)
File "sqlalchemy/engine/base.py", line 1193, in _execute_context
context)
File "sqlalchemy/engine/default.py", line 507, in do_execute
cursor.execute(statement, parameters)
InterfaceError: (sqlite3.InterfaceError) Error binding parameter 0 - probably unsupported type. [SQL: 'UPDATE products SET price=? WHERE products.id = ?'] [parameters: (<Price of value 360>, 1)] (Background on this error at: http://sqlalche.me/e/rvf5)
After setting config file and run the bot, /start command not working
log is:
Network error while calling get_updates(), retrying in 5 secs...
I can't find out why this is happening
It would be very cool if the bot could be run via WebHook
For example, the OrderItem table can use a "quantity" attribute
How to reproduce:
Add some global substitutions to the localization files.
For example:
{username}
in any localization file would get replaced by the user's username{today}
would get replaced by today's dateSuggested by @glookatme on Telegram
Steps to reproduce:
When issuing /start in Telegram the bot produces with the following error:
Exception in thread Worker 661051424:
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context
context)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute
cursor.execute(statement, parameters)
sqlite3.OperationalError: no such table: users
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/home/ubuntu/greed-master/worker.py", line 64, in run
self.user = self.session.query(db.User).filter(db.User.user_id == self.chat.id).one_or_none()
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2924, in one_or_none
ret = list(self)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2995, in __iter__
return self._execute_and_instances(context)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 3018, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 948, in execute
return meth(self, multiparams, params)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1060, in _execute_clauseelement
compiled_sql, distilled_params
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1200, in _execute_context
context)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception
exc_info
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 265, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 248, in reraise
raise value.with_traceback(tb)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context
context)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: users [SQL: 'SELECT users.user_id AS users_user_id, users.first_name AS users_first_name, users.last_name AS users_last_name, users.username AS users_username, users.credit AS users_credit \nFROM users \nWHERE users.user_id = ?'] [parameters: (661051424,)] (Background on this error at: http://sqlalche.me/e/e3q8)
Tried running the database generation script and then running the bot, the error persists.
[ubuntu@apollo greed-master]$ python3.6 -OO database.py
[ubuntu@apollo greed-master]$ python3.6 -OO core.py
greed-bot is now starting!
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
Exception in thread Worker 661051424:
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context
context)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute
cursor.execute(statement, parameters)
sqlite3.OperationalError: no such table: users
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/home/ubuntu/greed-master/worker.py", line 64, in run
self.user = self.session.query(db.User).filter(db.User.user_id == self.chat.id).one_or_none()
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2924, in one_or_none
ret = list(self)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 2995, in __iter__
return self._execute_and_instances(context)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/orm/query.py", line 3018, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 948, in execute
return meth(self, multiparams, params)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1060, in _execute_clauseelement
compiled_sql, distilled_params
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1200, in _execute_context
context)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception
exc_info
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 265, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/util/compat.py", line 248, in reraise
raise value.with_traceback(tb)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context
context)
File "/home/ubuntu/.local/lib/python3.6/site-packages/sqlalchemy/engine/default.py", line 509, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: users [SQL: 'SELECT users.user_id AS users_user_id, users.first_name AS users_first_name, users.last_name AS users_last_name, users.username AS users_username, users.credit AS users_credit \nFROM users \nWHERE users.user_id = ?'] [parameters: (661051424,)] (Background on this error at: http://sqlalche.me/e/e3q8)
[ubuntu@apollo greed-master]$ python -V
Python 2.7.15rc1
[ubuntu@apollo greed-master]$ python3 -V
Python 3.6.6
I went into the admin panel to edit managers and then clicked Cancel
Traceback (most recent call last): File "/home/codeofhonor/greed/worker.py", line 106, in run self.__admin_menu() File "/home/codeofhonor/greed/worker.py", line 739, in __admin_menu self.__add_admin() File "/home/codeofhonor/greed/worker.py", line 1211, in __add_admin if callback.data == "toggle_edit_products": AttributeError: 'CancelSignal' object has no attribute 'data'
-- @glookatme
Probably requires the same fix as #37 :)
when i press start on bot i catching this error:
C:\tg_bot1\greed-master>python -OO core.py
greed-bot is now starting!
Traceback (most recent call last):
File "core.py", line 131, in <module>
main()
File "core.py", line 63, in main
new_worker = worker.ChatWorker(bot, update.message.chat)
File "C:\tg_bot1\greed-master\worker.py", line 57, in __init__
release=raven.fetch_git_sha(os.path.dirname(__file__)),
File "D:\Python\lib\site-packages\raven\versioning.py", line 19, in fetch_git_
sha
'Cannot identify HEAD for git repository at %s' % (path,))
raven.exceptions.InvalidGitRepository: Cannot identify HEAD for git repository a
t C:\tg_bot1\greed-master
C:\tg_bot1\greed-master>
Suggestions to improve functionality:
/start
or My Orders
.Ciao, aiuto , per favore, come fare l'aggiunta di un prodotto in diverse categorie separatamente (Pizza, Panini, Pasta), e non in un catalogo in una sola volta? Grazie
Translation by @Steffo99:
Hi, please help, how can I split products in different categories (Pizza, Bread, Pasta) and not group them in a single catalog? Thanks!
And i have an feature request: If new order is created, send to all managers to private message order information. It will be very cool:)
Unauthorized to call get_me(), skipping.
greed-bot is now starting!
Unauthorized to call get_updates(), skipping.
Traceback (most recent call last):
File "core.py", line 123, in
main()
File "core.py", line 43, in main
for update in updates:
TypeError: 'NoneType' object is not iterable
How can I resolve this issue
Thanks
Right now, keyboards with more than 100 keys are not displayed correctly.
Previous page and Next page buttons should be implemented to display all keys correctly.
This issue is a generalization of #10.
$ sudo python3 -OO core.py
greed-bot is now starting!
Timed out while calling get_updates(), retrying in 1 secs...
Exception in thread Worker 411164928:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context
context)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/default.py", line 509, in do_execute
cursor.execute(statement, parameters)
sqlite3.OperationalError: no such table: users
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3.6/threading.py", line 916, in _bootstrap_inner
self.run()
File "/home/ubuntu/tlgrm_shop/worker.py", line 64, in run
self.user = self.session.query(db.User).filter(db.User.user_id == self.chat.id).one_or_none()
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/query.py", line 2917, in one_or_none
ret = list(self)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/query.py", line 2988, in iter
return self._execute_and_instances(context)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/orm/query.py", line 3011, in _execute_and_instances
result = conn.execute(querycontext.statement, self._params)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 948, in execute
return meth(self, multiparams, params)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/sql/elements.py", line 269, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 1060, in _execute_clauseelement
compiled_sql, distilled_params
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 1200, in _execute_context
context)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 1413, in _handle_dbapi_exception
exc_info
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/util/compat.py", line 265, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/util/compat.py", line 248, in reraise
raise value.with_traceback(tb)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/base.py", line 1193, in _execute_context
context)
File "/usr/local/lib/python3.6/dist-packages/sqlalchemy/engine/default.py", line 509, in do_execute
cursor.execute(statement, parameters)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) no such table: users [SQL: 'SELECT users.user_id AS users_user_id, users.first_name AS users_first_name, users.last_name AS users_last_name, users.username AS users_username, users.credit AS users_credit \nFROM users \nWHERE users.user_id = ?'] [parameters: (411164928,)] (Background on this error at: http://sqlalche.me/e/e3q8)
Timed out while calling get_updates(), retrying in 1 secs...
Timed out while calling get_updates(), retrying in 1 secs...
how can add products and browse them by category ?
I want to make bot-catalog which can receive orders without online payments. So please if it is possible guide me what code should I change to achieve this?
After trying to complete an order with insufficient funds, clicking add funds returns an error. The error can be replicated on a new installation from the master branch.
Steps to replicate:
Place order without enough credit > Add funds
Full error: Payment_provider_invalid
https://sentry.io/stefano-pigozzi/greed/issues/526439686/
KeyError: 5698
File "greed/worker.py", line 76, in run
self.__user_menu()
File "greed/worker.py", line 254, in __user_menu
self.__order_menu()
File "greed/worker.py", line 316, in __order_menu
product = cart[callback.message.message_id][0]
KeyError: 5698
2020-04-29 01:02:53 | Worker 525147055 | sqlalchemy.pool.impl.NullPool | Exception during reset or similar
Traceback (most recent call last):
File "C:\Users\stepi\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\pool\base.py", line 693, in _finalize_fairy
fairy._reset(pool)
File "C:\Users\stepi\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\pool\base.py", line 880, in _reset
pool._dialect.do_rollback(self)
File "C:\Users\stepi\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\engine\default.py", line 540, in do_rollback
dbapi_connection.rollback()
sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 8780 and this is thread id 21508.
2020-04-29 01:02:53 | Worker 525147055 | sqlalchemy.pool.impl.NullPool | Exception closing connection <sqlite3.Connection object at 0x0000028D5F544D50>
Traceback (most recent call last):
File "C:\Users\stepi\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\pool\base.py", line 693, in _finalize_fairy
fairy._reset(pool)
File "C:\Users\stepi\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\pool\base.py", line 880, in _reset
pool._dialect.do_rollback(self)
File "C:\Users\stepi\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\engine\default.py", line 540, in do_rollback
dbapi_connection.rollback()
sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 8780 and this is thread id 21508.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\stepi\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\pool\base.py", line 270, in _close_connection
self._dialect.do_close(connection)
File "C:\Users\stepi\AppData\Local\Programs\Python\Python38\lib\site-packages\sqlalchemy\engine\default.py", line 546, in do_close
dbapi_connection.close()
sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id 8780 and this is thread id 21508.
Dopo aver effettuato un ordine, il negoziante l'ha rifiutato restituendomi il credito speso, ma nel portafoglio non sono stati riaggiunti
The Transaction list from the admin menu does not load transactions if any are present. The error can be replicated on a new installation from the master branch.
Steps to replicate:
Create transactions manually from admin panel > Transaction list
Full error: Can't parse entities: unsupported start tag "transaction" at byte offset 16
I want to use MySQL instead of SQLite.
But an error occurs after switching engine.
Hello, Steffo! I am very interested in your Greed telegram bot, it’s really cool! But I have a bug, and don’t know how to fix. If I set minimum deposit, for example 100$, everything under this value crashing the bot.
Best regards,
Yaroslav Khaliullin.
https://sentry.io/stefano-pigozzi/greed/issues/529983887/
JSONDecodeError: Expecting value: line 1 column 1 (char 0)
File "telegram/utils/request.py", line 150, in _parse
data = json.loads(decoded_s)
File "json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
TelegramError: Invalid server response
(2 additional frame(s) were not displayed)
...
File "telegram/bot.py", line 60, in decorator
result = func(self, *args, **kwargs)
File "telegram/bot.py", line 1720, in get_updates
result = self._request.post(url, data, timeout=float(read_latency) + float(timeout))
File "telegram/utils/request.py", line 272, in post
**urlopen_kwargs)
File "telegram/utils/request.py", line 203, in _request_wrapper
message = self._parse(resp.data)
File "telegram/utils/request.py", line 152, in _parse
raise TelegramError('Invalid server response')
TelegramError: Invalid server response
Add a menu that allows to remove someone from a Manager position.
Traceback (most recent call last):
File "core.py", line 169, in
main()
File "core.py", line 111, in main
if update.message.text == receiving_worker.loc.get("menu_cancel"):
AttributeError: 'NoneType' object has no attribute 'get'
The link is https://t.me/greed_project.
https://sentry.io/stefano-pigozzi/greed/issues/526391945/
AttributeError: 'CancelSignal' object has no attribute 'message'
File "greed/worker.py", line 76, in run
self.__user_menu()
File "greed/worker.py", line 250, in __user_menu
strings.menu_add_credit, strings.menu_bot_info])
File "greed/worker.py", line 132, in __wait_for_specific_message
if update.message is None:
AttributeError: 'CancelSignal' object has no attribute '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.