JabberCard/jabbercard/xmpp/xep_0369.py

35 lines
1.1 KiB
Python
Raw Permalink Normal View History

#!/usr/bin/python
# -*- coding: utf-8 -*-
from asyncio import TimeoutError
from slixmpp.exceptions import IqError, IqTimeout, PresenceError
class XmppXep0369:
async def get_room_information(self, jid, alias):
iq = await self['xep_0369'].join_channel(jid, alias)
breakpoint()
print('GOOD DAY! Please contact the developer!')
try:
error = False
condition = text = ''
#iq = await self['xep_0369'].get_channel_info(jid)
iq = await self['xep_0369'].join_channel(jid, alias)
except TimeoutError as e:
#raise HTTPException(status_code=504, detail='request-timeout-reached')
error = True
iq = e
condition = 'Request timeout reached'
text = str(e)
except (IqError, IqTimeout, PresenceError) as e:
error = True
iq = e
condition = e.iq['error']['condition']
text = e.iq['error']['text']
result = {
'error' : error,
'condition' : condition,
'text' : text,
'iq' : iq}
return result