|
11 | 11 | get_month_expenses, |
12 | 12 | get_month_and_year, |
13 | 13 | is_group, |
| 14 | + get_month_filters, |
14 | 15 | new_expense, |
15 | 16 | new_payment, |
16 | 17 | show_expenses, |
@@ -97,6 +98,18 @@ async def export(update, context, user, group): |
97 | 98 | ) |
98 | 99 |
|
99 | 100 |
|
| 101 | +@user_and_group |
| 102 | +async def export_month(update, context, user, group): |
| 103 | + month, year = get_month_and_year(context.args) |
| 104 | + expense_filters = get_month_filters(year, month) |
| 105 | + extra_name = f"{year}-{month}" |
| 106 | + exporter = ExportExpenses(user, group, extra_name, expense_filters) |
| 107 | + text = await exporter.run() |
| 108 | + await context.bot.send_message( |
| 109 | + chat_id=update.message.chat_id, text=text, parse_mode=ParseMode.MARKDOWN |
| 110 | + ) |
| 111 | + |
| 112 | + |
100 | 113 | async def vianda(update, context): |
101 | 114 | vianda_message = ViandaMessage(*context.args) |
102 | 115 |
|
@@ -125,6 +138,7 @@ async def unknown(update, context): |
125 | 138 | CommandHandler('asado', calc_asado), |
126 | 139 | CommandHandler('a', calc_asado), |
127 | 140 | CommandHandler('exportar', export), |
| 141 | + CommandHandler('exportar_mes', export_month), |
128 | 142 | CommandHandler('vianda', vianda), |
129 | 143 | MessageHandler(filters.COMMAND, unknown), |
130 | 144 | ] |
0 commit comments