1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 19:44:20 +00:00

Prevent duplicate mmresponses from being inserted

This commit is contained in:
Steffo 2020-07-31 16:16:18 +02:00
parent 0d1757f4c8
commit ae3f88cc72

View file

@ -5,6 +5,7 @@ import logging
import datetime import datetime
import enum import enum
import asyncio as aio import asyncio as aio
import psycopg2
from telegram import InlineKeyboardMarkup as InKM from telegram import InlineKeyboardMarkup as InKM
from telegram import InlineKeyboardButton as InKB from telegram import InlineKeyboardButton as InKB
@ -179,7 +180,10 @@ class MMTask:
else: else:
# Change their response # Change their response
mmresponse.choice = choice mmresponse.choice = choice
try:
await data.session_commit() await data.session_commit()
except psycopg2.Error:
raise rc.UserError("Hai già risposto nello stesso modo a questo matchmaking.")
await self.telegram_channel_message_update() await self.telegram_channel_message_update()