mirror of
				https://github.com/civsocit/olgram.git
				synced 2023-07-22 01:29:12 +03:00 
			
		
		
		
	promo minor changes
This commit is contained in:
		
							parent
							
								
									74a04c2792
								
							
						
					
					
						commit
						b229a2c7e2
					
				@ -25,6 +25,8 @@ async def info(message: types.Message, state: FSMContext):
 | 
			
		||||
    bots_count = len(bots)
 | 
			
		||||
    user_count = len(await models.User.all())
 | 
			
		||||
    templates_count = len(await models.DefaultAnswer.all())
 | 
			
		||||
    promo_count = len(await models.Promo.all())
 | 
			
		||||
    olgram_text_disabled = len(await models.Bot.filter(enable_olgram_text=False))
 | 
			
		||||
 | 
			
		||||
    income_messages = sum([bot.incoming_messages_count for bot in bots])
 | 
			
		||||
    outgoing_messages = sum([bot.outgoing_messages_count for bot in bots])
 | 
			
		||||
@ -33,4 +35,6 @@ async def info(message: types.Message, state: FSMContext):
 | 
			
		||||
                         _("Количество пользователей (у конструктора): {0}\n").format(user_count) +
 | 
			
		||||
                         _("Шаблонов ответов: {0}\n").format(templates_count) +
 | 
			
		||||
                         _("Входящих сообщений у всех ботов: {0}\n").format(income_messages) +
 | 
			
		||||
                         _("Исходящих сообщений у всех ботов: {0}\n").format(outgoing_messages))
 | 
			
		||||
                         _("Исходящих сообщений у всех ботов: {0}\n").format(outgoing_messages) +
 | 
			
		||||
                         _("Промо-кодов выдано: {0}\n").format(promo_count) +
 | 
			
		||||
                         _("Рекламную плашку выключили: {0}\n".format(olgram_text_disabled)))
 | 
			
		||||
 | 
			
		||||
@ -48,6 +48,12 @@ async def del_promo(message: types.Message, state: FSMContext):
 | 
			
		||||
    if not promo:
 | 
			
		||||
        return await message.answer(_("Такого кода не существует"))
 | 
			
		||||
 | 
			
		||||
    user = await models.User.filter(promo=promo)
 | 
			
		||||
    bots = await user.bots()
 | 
			
		||||
    for bot in bots:
 | 
			
		||||
        bot.enable_olgram_text = True
 | 
			
		||||
        await bot.save(update_fields=["enable_olgram_text"])
 | 
			
		||||
 | 
			
		||||
    await promo.delete()
 | 
			
		||||
 | 
			
		||||
    await message.answer(_("Промокод отозван"))
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user