fork of https://f-hub.org/XMPP/xmpp-discord-bridge

Merge pull request 'Fix for a bug when the bridge is used in guilds without icons' (#17) from luca-patch-1 into main

Reviewed-on: https://f-hub.org/XMPP/xmpp-discord-bridge/pulls/17

poVoq 89941bdc c81d0b1f

+6 -8
+6 -8
xmpp_discord_bridge/main.py
··· 210 210 211 211 # TODO: Is this working? 212 212 # Mirror the guild's icon 213 - if self._mirror_icon: 214 - icon_url = dchannel.guild.icon.url 215 - if icon_url: 216 - req = requests.get(icon_url) 213 + if self._mirror_icon and dchannel.guild.icon and dchannel.guild.icon.url: 214 + req = requests.get(dchannel.guild.icon.url) 217 215 218 - vcard = self.plugin["xep_0054"].make_vcard() 219 - vcard["PHOTO"]["TYPE"] = "image/png" 220 - vcard["PHOTO"]["BINVAL"] = base64.b64encode(req.content) 221 - await self.plugin["xep_0054"].publish_vcard(vcard) 216 + vcard = self.plugin["xep_0054"].make_vcard() 217 + vcard["PHOTO"]["TYPE"] = "image/png" 218 + vcard["PHOTO"]["BINVAL"] = base64.b64encode(req.content) 219 + await self.plugin["xep_0054"].publish_vcard(vcard) 222 220 223 221 # Acquire a webhook 224 222 wh = None