diff --git a/stickerbridge/sticker_types.py b/stickerbridge/sticker_types.py index 367e92c..e0c3a3d 100644 --- a/stickerbridge/sticker_types.py +++ b/stickerbridge/sticker_types.py @@ -15,6 +15,13 @@ class MatrixStickerset: } def add_sticker(self, mxc_uri: str, alt_text: str): + if alt_text in self._content['images']: + duplicate_counter = 1 + alt_text = alt_text + '-' + str(duplicate_counter) + while (alt_text in self._content['images']): + duplicate_counter += 1 + alt_text = alt_text.split('-')[0] + '-' + str(duplicate_counter) + print(alt_text) self._content['images'][alt_text] = { "url": mxc_uri, "usage": ["sticker"]