How to use the errbot.backends.base.RoomDoesNotExistError function in errbot

To help you get started, we’ve selected a few errbot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github errbotio / errbot / errbot / backends / slack.py View on Github external
def channelid_to_channelname(self, id_):
        """Convert a Slack channel ID to its channel name"""
        channel = [channel for channel in self.sc.server.channels if channel.id == id_]
        if not channel:
            raise RoomDoesNotExistError("No channel with ID %s exists" % id_)
        return channel[0].name
github errbotio / errbot / errbot / backends / hipchat.py View on Github external
def destroy(self):
        """
        Destroy the room.

        Calling this on a non-existing room is a no-op.
        """
        try:
            self.room.delete()
            log.info('Destroyed room %s.', self)
        except RoomDoesNotExistError:
            log.debug("Can't destroy room %s, it doesn't exist.", self)
github errbotio / errbot / errbot / backends / hipchat.py View on Github external
def query_room(self, room):
        """
        Query a room for information.

        :param room:
            The name (preferred) or XMPP JID of the room to query for.
        :returns:
            An instance of :class:`~HipChatRoom`.
        """
        if room.endswith('@conf.hipchat.com') or room.endswith('@conf.btf.hipchat.com'):
            log.debug("Room specified by JID, looking up room name")
            rooms = self.conn.hypchat.rooms(expand='items').contents()
            try:
                name = [r['name'] for r in rooms if r['xmpp_jid'] == room][0]
            except IndexError:
                raise RoomDoesNotExistError(f'No room with JID {room} found.')
            log.info('Found %s to be the room %s, consider specifying this directly.', room, name)
        else:
            name = room

        return HipChatRoom(name, self)
github errbotio / errbot / errbot / backends / slack.py View on Github external
def channelname_to_channelid(self, name):
        """Convert a Slack channel name to its channel ID"""
        if name.startswith('#'):
            name = name[1:]
        channel = [channel for channel in self.sc.server.channels if channel.name == name]
        if not channel:
            raise RoomDoesNotExistError("No channel named %s exists" % name)
        return channel[0].id
github errbotio / errbot / errbot / backends / hipchat.py View on Github external
def room(self):
        """
        Return room information from the HipChat API
        """
        try:
            log.debug('Querying HipChat API for room %s.', self.name)
            return self.hypchat.get_room(self.name)
        except hypchat.requests.HttpNotFound:
            raise RoomDoesNotExistError('The given room does not exist.')
github errbotio / errbot / errbot / backends / slack.py View on Github external
def _channel(self):
        """
        The channel object exposed by SlackClient
        """
        id_ = self.sc.server.channels.find(self.name)
        if id_ is None:
            raise RoomDoesNotExistError(
                "%s does not exist (or is a private group you don't have access to)" % str(self)
            )
        return id_