🚑 hotfix: listen KeyError bug

This commit is contained in:
xtaodada 2022-07-14 13:31:59 +08:00
parent a3ee603cd2
commit f66530ac87
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -18,7 +18,9 @@ You should have received a copy of the GNU General Public License
along with pyromod. If not, see <https://www.gnu.org/licenses/>.
"""
import asyncio
import contextlib
import functools
from typing import Optional, List, Union
@ -70,6 +72,7 @@ class Client:
@patchable
def clear_listener(self, chat_id, future):
with contextlib.suppress(KeyError):
if future == self.listening[chat_id]["future"]:
self.listening.pop(chat_id, None)