Пример #1
0
    def execute(self, user: User, alias: str, args: str,
                respond: ResponseHook) -> bool:
        """
        Same as !request, but automatically picks from ALL possible matches. This includes matches that cannot
        be picked with !pick due to lower relevance. Usually best used with artists, e.g. !random acdc
        """
        with self._queue:
            match = CustomDLC.random(args, *self.__exclusions())
            if not match:
                without_exclusions = CustomDLC.random_pool(query=args).count()
                message = f'Everything already played or enqueued' if without_exclusions else f'No matches'
                return respond.to_sender(f'{message} for <{args}>')

            request = Match(user, args, match)
            return self._enqueue_request(user, request, respond)
Пример #2
0
def test_random(es_cdlc):
    assert_that(CustomDLC.random('definitely not here')).is_none()

    assert_that(CustomDLC.random().id).is_in(12990, 49874, 49886)