Created
July 25, 2020 16:33
-
-
Save xnuinside/c72d1a87353131f9fc7d482685f679a8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@bot.message_handler(commands=['stats']) | |
def send_package_stats(message): | |
package_name = message.text.split()[1].replace('_', '-') | |
output = f"Stats for package {package_name} (numbers of downloads): \n" | |
for i in range(4): | |
date_ = (datetime.now().date() - timedelta(days=i+1)).isoformat() | |
formatted_date_ = date_.replace('-', '') | |
downloads = bq_get_downloads_stats_for_package(package_name, formatted_date_) | |
output += f"<b>{date_}</b>: {downloads}\n" | |
bot.reply_to(message, output, parse_mode="html") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment