mirror of
https://gitlab.com/simple-stock-bots/simple-telegram-stock-bot.git
synced 2025-07-27 00:21:27 +00:00
patch to stop inline queries from failing until stock data is added
This commit is contained in:
@@ -34,6 +34,10 @@ from T_info import T_info
|
||||
|
||||
# Enable logging
|
||||
logging.basicConfig(format="%(asctime)s - %(name)s - %(levelname)s - %(message)s", level=logging.INFO)
|
||||
|
||||
# set higher logging level for httpx to avoid all GET and POST requests being logged
|
||||
logging.getLogger("httpx").setLevel(logging.WARNING)
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
TELEGRAM_TOKEN = os.environ["TELEGRAM"]
|
||||
@@ -316,13 +320,16 @@ async def trending(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
)
|
||||
|
||||
|
||||
async def inline_query(update: Update, context: ContextTypes.DEFAULT_TYPE):
|
||||
async def inline_query(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
"""
|
||||
Handles inline query. Searches by looking if query is contained
|
||||
in the symbol and returns matches in alphabetical order.
|
||||
"""
|
||||
# info(f"Inline command ran by {update.message.chat.username}")
|
||||
log.info(f"Query: {update.inline_query.query}")
|
||||
|
||||
if not update.inline_query.query:
|
||||
return
|
||||
|
||||
print(f"Query: {update.inline_query.query}")
|
||||
|
||||
ignored_queries = {"$", "$$", " ", ""}
|
||||
|
||||
@@ -443,7 +450,7 @@ def main():
|
||||
application.add_error_handler(error)
|
||||
|
||||
# Start the Bot
|
||||
application.run_polling()
|
||||
application.run_polling(allowed_updates=Update.ALL_TYPES)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Reference in New Issue
Block a user