From 52a6f5e96a1b9490ace3c191d63eea720f77a1ad Mon Sep 17 00:00:00 2001 From: Battlefield Duck Date: Wed, 1 Nov 2023 04:47:57 +0800 Subject: [PATCH] Update database.py --- discordgsm/database.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/discordgsm/database.py b/discordgsm/database.py index 2cd5ae5..6f3fc51 100644 --- a/discordgsm/database.py +++ b/discordgsm/database.py @@ -531,8 +531,11 @@ def update_servers_style_data(self, servers: list[Server]): def __update_servers_channel_id(self, servers: list[Server], channel_id: int): if self.driver == Driver.MongoDB: - max_position = self.collection.find_one({'channel_id': channel_id}, sort=[ - ('position', -1)])["position"] + try: + max_position = self.collection.find_one({'channel_id': channel_id}, sort=[ + ('position', -1)])["position"] + except TypeError: + max_position = 0 operations = []