Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
569fe3d364
@ -113,9 +113,6 @@ class TelegramBotHandler:
|
||||
def handle_status(self):
|
||||
today = timezone.now().date()
|
||||
first_day_of_current_month = today.replace(day=1)
|
||||
first_day_of_previous_month = (
|
||||
first_day_of_current_month -
|
||||
datetime.timedelta(days=1)).replace(day=1)
|
||||
host_url = Settings.get_setting("HOST_URL", "http://localhost:8000")
|
||||
|
||||
send_message("sendMessage", {
|
||||
@ -174,7 +171,7 @@ class TelegramBotHandler:
|
||||
required_count = int(
|
||||
Settings.get_setting("circle_required_count", "4"))
|
||||
user_circes_count = Circle.objects.filter(
|
||||
uploaded_at__gte=first_day_of_previous_month,
|
||||
uploaded_at__gte=first_day_of_current_month,
|
||||
user=self.user_state).count()
|
||||
send_message("sendMessage", {
|
||||
'chat_id': self.chat_id,
|
||||
|
||||
@ -2,5 +2,5 @@ import re
|
||||
|
||||
|
||||
def is_corporate_email(email):
|
||||
pattern = r'^[a-zA-Z0-9._%+-]+@cybercode\.pro$'
|
||||
pattern = r'^[a-zA-Z0-9._%+-]+@(cybercode\.pro|pgpi\.su)$'
|
||||
return bool(re.fullmatch(pattern, email))
|
||||
|
||||
@ -15,18 +15,17 @@ import requests
|
||||
|
||||
class TelegramBotWebhookView(CSRFExemptMixin, View):
|
||||
def post(self, request):
|
||||
if request.method == 'POST':
|
||||
message = {}
|
||||
try:
|
||||
message = json.loads(request.body.decode('utf-8'))
|
||||
dispatcher = TelegramBotDispatcher()
|
||||
dispatcher.dispatch(message)
|
||||
except Exception as e:
|
||||
error_logger.error(
|
||||
f"Ошибка во время обработки сообщения: {e}\nСообщение: {message}\n")
|
||||
return HttpResponse('error', status=500)
|
||||
message = {}
|
||||
try:
|
||||
message = json.loads(request.body.decode('utf-8'))
|
||||
dispatcher = TelegramBotDispatcher()
|
||||
dispatcher.dispatch(message)
|
||||
return HttpResponse('ok')
|
||||
except Exception as e:
|
||||
error_logger.error(
|
||||
f"Ошибка во время обработки сообщения: {e}\nСообщение: {message}\n")
|
||||
return HttpResponse('error', status=500)
|
||||
|
||||
return HttpResponse('ok')
|
||||
|
||||
|
||||
class TelegramBotSetwebhookView(View):
|
||||
|
||||
@ -64,6 +64,7 @@ class ReportView(LoginRequiredMixin, FormView):
|
||||
continue
|
||||
user_circles_count = Circle.objects.filter(
|
||||
uploaded_at__gte=start_date,
|
||||
uploaded_at__lte=end_date,
|
||||
user=user).count()
|
||||
if user_circles_count < required_count:
|
||||
report['not_accessed'].append({
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user